{"id":143,"date":"2014-06-15T22:41:00","date_gmt":"2014-06-16T06:41:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vbteam\/2014\/06\/15\/vb-universal-windows-app-part-2-for-the-developer-sharing-xaml-assets-and-code\/"},"modified":"2024-07-05T12:37:53","modified_gmt":"2024-07-05T19:37:53","slug":"vb-universal-windows-app-part-2-for-the-developer-sharing-xaml-assets-and-code","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vbteam\/vb-universal-windows-app-part-2-for-the-developer-sharing-xaml-assets-and-code\/","title":{"rendered":"VB Universal Windows App Part 2 (for the developer): sharing XAML, Assets and Code"},"content":{"rendered":"<p>This is Part 2 of the &#8220;<a href=\"http:\/\/blogs.msdn.com\/b\/vbteam\/archive\/tags\/universal\/\">VB Universal Windows App<\/a>&#8221; series:<\/p>\n<ul>\n<li><a href=\"http:\/\/blogs.msdn.com\/b\/vbteam\/archive\/2014\/06\/15\/vb-universal-app-part-1-getting-started.aspx\">Part 1: Setting up the universal Windows app in the Dev Centers, and in VS Solution Explorer<\/a><\/li>\n<li><strong>&gt; Part 2: Sharing XAML, Assets and Code<\/strong><\/li>\n<li><span style=\"color: #000000\"><a href=\"http:\/\/blogs.msdn.com\/b\/vbteam\/archive\/2014\/06\/15\/vb-universal-app-part-3-for-the-end-user-roaming-settings-and-in-app-purchases.aspx\">Part 3: Local and Roaming settings, and In-App purchases<\/a><\/span><\/li>\n<li><span style=\"color: #000000\"><a href=\"http:\/\/blogs.msdn.com\/b\/vbteam\/archive\/2014\/06\/15\/vb-universal-app-part-4-using-sharpdx-for-sound-effects-with-ioc-and-linkedfiles.aspx\">Part 4: Sound effects with SharpDX<\/a><\/span><\/li>\n<li><span style=\"color: #000000\"><a href=\"http:\/\/blogs.msdn.com\/b\/vbteam\/archive\/2014\/06\/20\/vb-universal-windows-app-part-5-calling-into-platform-specific-apis-from-pcl.aspx\">Part 5: How to call platform-specific APIs from common code<\/a><\/span><\/li>\n<li><span style=\"color: #000000\"><a href=\"http:\/\/blogs.msdn.com\/b\/vbteam\/archive\/2014\/06\/21\/vb-universal-app-downloads.aspx\">Download full source code<\/a><\/span><\/li>\n<\/ul>\n<p>In Part 1 we set ourselves up by registering the app in the two Dev Centers, and by creating the basic structure in Solution Explorer.<\/p>\n<p>In Part 2 today, we&#8217;re going to share! From a developer perspective, the benefit of universal Windows apps is in sharing as much as possible between the two projects you have to build. Let&#8217;s step back and see what can be re-used&#8230;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/4075.image18.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/4075.image18.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<ul>\n<li><em>MainPage.xaml<\/em>&#8211; yes, we will re-use xaml and codebehind by adding it to the PCL<\/li>\n<li><em>App.xaml<\/em>&#8211; we can&#8217;t re-use the App.xaml file itself, but we will re-use the bulk of the codebehind file App.xaml.vb by factoring it into common methods in the PCL.<\/li>\n<li>Manifest- no, these are different between the two projects.<\/li>\n<li><em>Assets<\/em>&#8211; yes, we will re-use assets by adding them to the Assets folder of the PCL. However, some assets like application-icons are different resolutions between the two devices and can&#8217;t be re-used.<\/li>\n<li><em>References<\/em> &#8211; yes, we generally add references and NuGet packages just once to the PCL rather than adding them twice to each app. However some references aren&#8217;t PCL-ready and can&#8217;t be re-used &#8211; this will be covered in Part 4<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>Sharing XAML<\/h2>\n<p>For our simple game, we&#8217;re going to re-use a single XAML page and code-behind between Windows and Windows Phone versions of the app. That&#8217;s because the page is similar enough between the two form factors.<\/p>\n<ul>\n<li><a href=\"http:\/\/media.ch9.ms\/ch9\/c44f\/11750aa9-c7bb-4305-b6f9-115d3bcdc44f\/3ShareXaml_Source.wmv\">How Do I video: re-use a XAML page between Windows and Windows Phone<\/a> [4mins]<\/li>\n<\/ul>\n<p>Look at the different ways our game might be displayed on two devices:<\/p>\n<table style=\"border: currentColor;border-collapse: collapse\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"padding: 0in 5.4pt;border: 1pt solid windowtext;width: 155.8pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">Phone &gt; Portrait<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\"><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/0882.image19.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/0882.image19.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<\/td>\n<td style=\"border-width: 1pt 1pt 1pt medium;border-style: solid solid solid none;border-color: windowtext windowtext windowtext currentColor;padding: 0in 5.4pt;width: 155.85pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">Windows &gt; Snapped<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\"><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/4075.image20.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/4075.image20.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<\/td>\n<td style=\"border-width: 1pt 1pt 1pt medium;border-style: solid solid solid none;border-color: windowtext windowtext windowtext currentColor;padding: 0in 5.4pt;width: 155.85pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">Windows &gt; Half<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/8371.image21c.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/8371.image21c.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"border-width: medium 1pt 1pt;border-style: none solid solid;border-color: currentColor windowtext windowtext;padding: 0in 5.4pt;width: 155.8pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">Phone &gt; Landscape<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\"><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/0181.image22.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/0181.image22.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<\/td>\n<td style=\"border-width: medium 1pt 1pt medium;border-style: none solid solid none;border-color: currentColor windowtext windowtext currentColor;padding: 0in 5.4pt;width: 155.85pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">Windows &gt; FullScreen<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\"><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/2133.image23.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/2133.image23.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<\/td>\n<td style=\"border-width: medium 1pt 1pt medium;border-style: none solid solid none;border-color: currentColor windowtext windowtext currentColor;padding: 0in 5.4pt;width: 155.85pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">Windows &gt; Landscape<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\"><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/3617.image24.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/3617.image24.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>What&#8217;s striking is that the &#8220;Phone Portrait&#8221; and &#8220;Windows Snapped&#8221; views are almost identical &#8211; roughly same proportions, similar pixel counts, similar physical dimensions measured in inches.<\/p>\n<p><em>There&#8217;s good potential for XAML re-use between some Windows pages and some Windows Phone pages<\/em>.<\/p>\n<p>Those screenshots were from a simple one-page game. How does XAML re-use look for a more serious forms-over-data app? Here&#8217;s one I wrote called &#8220;Dementia Test&#8221;, used by clinicians to help diagnose Alzheimer&#8217;s Disease. Its look was inspired by the email app that comes with Windows 8. You can see that, even here, there&#8217;s still good potential for XAML re-use between devices.<\/p>\n<table style=\"border: currentColor;border-collapse: collapse\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"padding: 0in 5.4pt;border: 1pt solid windowtext;width: 155.8pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">List of forms<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\"><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/6545.image25.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/6545.image25.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<\/p>\n<\/td>\n<td style=\"border-width: 1pt 1pt 1pt medium;border-style: solid solid solid none;border-color: windowtext windowtext windowtext currentColor;padding: 0in 5.4pt;width: 155.85pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">Details view<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\"><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/7737.image26.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/7737.image26.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<\/td>\n<td style=\"border-width: 1pt 1pt 1pt medium;border-style: solid solid solid none;border-color: windowtext windowtext windowtext currentColor;padding: 0in 5.4pt;width: 155.85pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<\/p>\n<p style=\"line-height: normal;margin-bottom: 0pt\">On full-screen devices, it can fit the ListOfForms and the DetailsView side-by-side&#8230;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"border-width: medium 1pt 1pt;border-style: none solid solid;border-color: currentColor windowtext windowtext;padding: 0in 5.4pt;width: 155.8pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\"><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/1033.image27.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/1033.image27.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<\/td>\n<td style=\"border-width: medium 1pt 1pt medium;border-style: none solid solid none;border-color: currentColor windowtext windowtext currentColor;padding: 0in 5.4pt;width: 155.85pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/2248.image28.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/2248.image28.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<\/td>\n<td style=\"border-width: medium 1pt 1pt medium;border-style: none solid solid none;border-color: currentColor windowtext windowtext currentColor;padding: 0in 5.4pt;width: 155.85pt\" valign=\"top\" width=\"312\">\n<p style=\"line-height: normal;margin-bottom: 0pt\">&nbsp;<a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/6761.image29.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/6761.image29.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p style=\"margin-left: 0in\"><strong>To re-use a XAML page<\/strong>, simply add the page to your PCL.<\/p>\n<p style=\"margin-left: 0in\">&nbsp;<\/p>\n<p style=\"margin-left: 0in\">Use the &#8220;Context Switcher&#8221; (new in VS2013 Update 2) to preview in the designer how the page looks on Windows and Windows Phone:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/8117.image30.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/8117.image30.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p>You&#8217;ll have to make sure the page layout works properly for the device sizes, DPI and aspect ratios it runs on. For this game, I did this with code in the page&#8217;s SizeChanged event handler. (If you need to get the actual pixel density, e.g. to make something exactly 1 inch long on every device, read <a href=\"http:\/\/dwcares.com\/actual-size\/\">here<\/a>).<\/p>\n<p style=\"margin-top: 0in;margin-right: 0in;margin-bottom: .0001pt;margin-left: .5in;line-height: normal\"><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Private <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Sub<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> Page_SizeChanged(sender <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">As <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Object<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">, e <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">As <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">SizeChangedEventArgs<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">)<\/span><br \/> <span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Dim<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> w = e.NewSize.Width, h = e.NewSize.Height<\/span><br \/> <span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">If<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> w &gt; h <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Then<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> w = h <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Else<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> h = w<\/span><br \/> <span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: green;background: white\">&#8216; picks the largest square that will fit inside the shape of the current window<\/span><br \/> <span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;border1.Width = w : border1.Height = h<\/span><br \/> <span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;image1.Width = w \/ 8 : image1.Height = h \/ 8<\/span><br \/> <span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">End <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Sub<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><em>When does it make sense to re-use XAML?<\/em> The XAML re-use described here is fine to get you going quickly. But when your app hits the big-time, customers will expect you to invest resources to make your app look absolutely perfect on whichever device, orientation or snap-size they might be using. You might find the differences become so great that you&#8217;re better off just using non-shared XAML.<\/p>\n<p style=\"margin-left: .5in\"><strong><em>Pro tip:<\/em><\/strong><em> In the XAML file, you can refer to device-specific resources like &#8220;{ThemeResource ApplicationPageBackgroundThemeBrush}&#8221;. On Windows Phone this will do the right thing (pick light or dark depending on the user&#8217;s currently selected theme). On Windows it will do the right thing (pick the standard dark grey #FF1D1D1D). That&#8217;s because XAML resolves these resources when the page is created, and the resource dictionaries are already set up correctly for the device.<\/em><\/p>\n<p style=\"margin-left: .5in\"><strong><em>Pro tip:<\/em><\/strong><em> There must be at least one XAML file in each project, otherwise things don&#8217;t work. This can easily be a &#8220;dummy&#8221; XAML file that you never actually use.<\/em><\/p>\n<p>&nbsp;<\/p>\n<h2>Sharing assets<\/h2>\n<p><strong>To re-use an asset, <\/strong>simply add it to App1_Common, typically in the Assets folder.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/6560.image31.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/6560.image31.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p>If you need to load a common asset from codebehind, note that its path is prepended with the name of the PCL&#8230;<\/p>\n<p><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: green;background: white\">&#8216; Loading it as a StorageFile<\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: blue;background: white\"><br \/> Dim<\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: black;background: white\"> folder = <\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: blue;background: white\">Await <\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: #2b91af;background: white\">Package<\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: black;background: white\">.Current.InstalledLocation.GetFolderAsync(<\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: #a31515;background: white\">&#8220;App1_CommonAssets&#8221;<\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: black;background: white\">)<br \/> <\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: blue;background: white\">Dim<\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: black;background: white\"> file = <\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: blue;background: white\">Await<\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: black;background: white\"> folder.GetFileAsync(<\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: #a31515;background: white\">&#8220;twelve-ball.png&#8221;<\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: black;background: white\">)<\/span><\/p>\n<p> <span style=\"font-size: 9.0pt;font-family: Consolas;color: green;background: white\">&#8216; Loading it with a URL<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\"><br \/> Dim<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> img = <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #a31515;background: white\">&#8220;ms-appx:\/\/\/App1_Common\/Assets\/twelve-ball.png&#8221;<\/span><br \/> <span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">image1.Source = <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">New <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">BitmapImage<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">(<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">New <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">Uri<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">(img, <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">UriKind<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">.Absolute))<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><em>When does it make sense to re-use assets?<\/em> Sharing some assets like sound files or configuration files makes perfect sense. As for sharing images, it depends on the kind of image. If it&#8217;s a 200&#215;200 jpg mugshot of someone&#8217;s face, I&#8217;d happily re-use that between Windows and Windows Phone. But if it&#8217;s a high-dpi 2560&#215;1600 background image, that&#8217;s probably only worth having on Windows.<\/p>\n<p>&nbsp;<\/p>\n<h2>Sharing code: App.vb<\/h2>\n<p>As things stand, the Windows project has &#8220;App.xaml.vb&#8221;, and the Windows Phone project also has &#8220;App.xaml.vb&#8221;, and the two are almost identical. We&#8217;ll avoid duplication by sharing the code across both projects.<\/p>\n<ul>\n<li><a href=\"http:\/\/media.ch9.ms\/ch9\/70f0\/859943ed-fcbe-48d1-ad8f-527070f370f0\/4ShareCode_Source.wmv\">How Do I video: re-use App.vb between Windows and Windows Phone<\/a> [2mins]<\/li>\n<\/ul>\n<p>The process is simple:<\/p>\n<ol>\n<li>Create a new common code file &#8220;App.vb&#8221; in your App1_Common.<\/li>\n<li>Move the body of &#8220;OnLaunched&#8221; and &#8220;OnSuspending&#8221; out from one of the original App.xaml.vb files into methods in this common App.vb<\/li>\n<li>Change both of the original App.xaml.vb so they simply invoke the common methods.<\/li>\n<\/ol>\n<p>Here&#8217;s how both of the App.xaml.vb files will look:<\/p>\n<p><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">NotInheritable <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Class <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">App<\/span><br \/> <span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Inherits <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">Application<\/span><\/p>\n<p> <span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Protected <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Overrides <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Sub<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> OnLaunched(e <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">As <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">LaunchActivatedEventArgs<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">)<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; App1_Common.<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">App<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">.OnLaunched(e)<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">End <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Sub<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Private <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Async <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Sub<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> OnSuspending(sender <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">As <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Object<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">, e <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">As <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">SuspendingEventArgs<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">) <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Handles <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Me<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">.Suspending<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Dim<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> deferral <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">As <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">SuspendingDeferral<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> = e.SuspendingOperation.GetDeferral()<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Await<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> App1_Common.<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">App<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">.OnSuspendingAsync()<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; deferral.Complete()<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">End <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Sub<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">End <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Class<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin-left: .5in\"><strong><em>Pro Tip:<\/em><\/strong><em> It can get confusing to tell which of the two App.xaml.vb files you&#8217;re editing. Some people use Tools &gt; Options &gt; ProjectsAndSolutions &gt; General &gt; TrackActiveItemInSolutionExplorer. In Roslyn we also introduced for VB the &#8220;project dropdown&#8221; in the nav-bar; this shows which project the current file is from.<\/em><\/p>\n<p style=\"margin-left: 0.5in\"><a href=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/8546.image32.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/vbteam\/wp-content\/uploads\/sites\/7\/2014\/06\/8546.image32.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>And here&#8217;s how the common &#8220;App.vb&#8221; will look:<\/p>\n<p><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Public <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Class <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">App<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">&nbsp;&nbsp;&nbsp; Public <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Shared <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Sub<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> OnLaunched(e <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">As<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">LaunchActivatedEventArgs<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">)<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Dim<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> rootFrame = <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">TryCast<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">(<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">Window<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">.Current.Content, <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">Frame<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">)<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">If<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> rootFrame <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Is <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Nothing<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Then<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rootFrame = <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">New <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">Frame<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">()<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> e.PreviousExecutionState = <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">ApplicationExecutionState<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">.Terminated <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Then<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: green;background: white\">&#8216; TODO: Load state from previously suspended application<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">Window<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">.Current.Content = rootFrame<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">End<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">If<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">If<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> rootFrame.Content <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Is <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Nothing<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Then<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rootFrame.Navigate(<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">GetType<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">(App1_Common.<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">AdaptiveMainPage<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">), e.Arguments)<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">End<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">If<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">Window<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">.Current.Activate()<br \/>&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: blue;background: white\">End <\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: blue;background: white\">Sub<br \/><\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">&nbsp;&nbsp;&nbsp; Public <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Shared <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Async <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Function<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\"> OnSuspendingAsync() <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">As<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">Task<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: green;background: white\">&#8216; TODO: Save application state and stop any background activity<\/span><br \/><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">&nbsp;&nbsp;&nbsp;&nbsp;&amp;nb\nsp; &nbsp;&nbsp;<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">If <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">False <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Then <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: blue;background: white\">Await <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: #2b91af;background: white\">Task<\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: black;background: white\">.Delay(0) <\/span><span style=\"font-size: 9.0pt;font-family: Consolas;color: green;background: white\">&#8216; just to suppress the compiler warning<br \/><\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: blue;background: white\">&nbsp;&nbsp;&nbsp; End <\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: blue;background: white\">Function<br \/> End <\/span><span style=\"font-size: 9.0pt;line-height: 107%;font-family: Consolas;color: blue\">Class<\/span><\/p>\n<p style=\"margin-left: 20.5pt\"><strong><em>Pro tip: <\/em><\/strong><em>The original App.xaml.vb for Windows Phone had some additional code for transitions. And the original App.xaml.vb for Windows had some additional code to throw exceptions when page navigation fails. For my app they didn&#8217;t add much value so I removed them. If you want to keep them, you&#8217;ll use the &#8220;IOC&#8221; technique described in Part 6.<\/em><\/p>\n<h2>Conclusion<\/h2>\n<p>In today&#8217;s blog post &#8220;Part 2&#8221; we made the most of sharing &#8211; we shared XAML, Assets and Code. Stay tuned for tomorrow&#8217;s post &#8220;Part 3&#8221;, where we code in the user-facing benefits of universal Windows apps &#8211; roaming state, and in-app purchases that work across all devices.<\/p>\n<p>&nbsp;<\/p>\n<p>&#8212; <br \/><em><strong>Lucian<\/strong><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is Part 2 of the &#8220;VB Universal Windows App&#8221; series: Part 1: Setting up the universal Windows app in the Dev Centers, and in VS Solution Explorer &gt; Part 2: Sharing XAML, Assets and Code Part 3: Local and Roaming settings, and In-App purchases Part 4: Sound effects with SharpDX Part 5: How to [&hellip;]<\/p>\n","protected":false},"author":258,"featured_media":8818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16,195],"tags":[36,99,160,180],"class_list":["post-143","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vb-universal-windows-apps","category-visual-basic","tag-async","tag-lucian-wischik","tag-universal","tag-windows-phone"],"acf":[],"blog_post_summary":"<p>This is Part 2 of the &#8220;VB Universal Windows App&#8221; series: Part 1: Setting up the universal Windows app in the Dev Centers, and in VS Solution Explorer &gt; Part 2: Sharing XAML, Assets and Code Part 3: Local and Roaming settings, and In-App purchases Part 4: Sound effects with SharpDX Part 5: How to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/users\/258"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/comments?post=143"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/143\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media\/8818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media?parent=143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/categories?post=143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/tags?post=143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}