Compiled Experience Windows Platform Development http://compiledexperience.com en Thu, 09 Apr 2015 22:21:05 +0000 Thu, 09 Apr 2015 22:21:05 +0000 What's new in Windows 10 - Title Bar <p>Microsoft have finally started to show off what&#39;s available in Windows 10 for us app developers. Over the next few days we can start to take a look at some of these changes and what it can mean. Today we&#39;ll look at what options we have to configure the new window Title Bar.</p> <h2>Disclaimer</h2> <p>This was written using the initial release of the Windows 10 Developer Tools running on Windows 10 build 10041 and things will mostly change before final release. I&#39;ll try to come back and keep these posts up to date as time goes on.</p> <h2>Title Bar</h2> <p>Now that our apps will work look and work like any standard desktop application we&#39;ll find them framed in a window with a title bar. By default the title bar will look like the image below with a grey bar. It will have the app name on the left and three standard windows buttons on the right.</p> <p><a href="/content/images/posts/default.png"><img width="600" src="/content/images/posts/default.png"/></a></p> <p>So what can we customise? Most things thankfully. The code below sets the text on the left to <strong>&lt;app name&gt; - My Custom Title</strong>. So it could be a good idea to update this each page of your app.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="kt">var</span> <span class="n">applicationView</span> <span class="p">=</span> <span class="n">ApplicationView</span><span class="p">.</span><span class="n">GetForCurrentView</span><span class="p">();</span> <span class="n">applicationView</span><span class="p">.</span><span class="n">Title</span> <span class="p">=</span> <span class="s">&quot;My Custom Title&quot;</span><span class="p">;</span> </code></pre></div> <p>The most likely thing we&#39;re going to want to do is customise the colours. We can do that using the <code>TitleBar</code> property of <code>ApplicationView</code>.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="kt">var</span> <span class="n">applicationView</span> <span class="p">=</span> <span class="n">ApplicationView</span><span class="p">.</span><span class="n">GetForCurrentView</span><span class="p">();</span> <span class="kt">var</span> <span class="n">titleBar</span> <span class="p">=</span> <span class="n">applicationView</span><span class="p">.</span><span class="n">TitleBar</span><span class="p">;</span> <span class="n">titleBar</span><span class="p">.</span><span class="n">BackgroundColor</span> <span class="p">=</span> <span class="p">(</span><span class="n">Color</span><span class="p">)</span> <span class="n">Resources</span><span class="p">[</span><span class="s">&quot;SidebarBackgroundColor&quot;</span><span class="p">];</span> <span class="n">titleBar</span><span class="p">.</span><span class="n">ForegroundColor</span> <span class="p">=</span> <span class="n">Colors</span><span class="p">.</span><span class="n">White</span><span class="p">;</span> <span class="n">titleBar</span><span class="p">.</span><span class="n">ButtonBackgroundColor</span> <span class="p">=</span> <span class="p">(</span><span class="n">Color</span><span class="p">)</span> <span class="n">Resources</span><span class="p">[</span><span class="s">&quot;LightSidebarBackgroundColor&quot;</span><span class="p">];</span> <span class="n">titleBar</span><span class="p">.</span><span class="n">ButtonForegroundColor</span> <span class="p">=</span> <span class="n">Colors</span><span class="p">.</span><span class="n">White</span><span class="p">;</span> </code></pre></div> <p>The first two properties change the background the bar itself and the colour of the title text. The second two set the background and foreground of the buttons. There&#39;s actually a LOT of properties for the buttons covering their hover and pressed states. I&#39;d recommend checking out the documentation on <a href="https://msdn.microsoft.com/en-ca/windows.ui.viewmanagement.applicationviewtitlebar">MSDN</a>.</p> <p>The code above gives us</p> <p><a href="/content/images/posts/colours.png"><img width="600" src="/content/images/posts/colours.png"/></a></p> <p>A third option is to remove the title bar altogether for that <em>chrome-less</em> look. We can use the <code>ExtendViewIntoTitleBar</code> property.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="kt">var</span> <span class="n">applicationView</span> <span class="p">=</span> <span class="n">ApplicationView</span><span class="p">.</span><span class="n">GetForCurrentView</span><span class="p">();</span> <span class="kt">var</span> <span class="n">titleBar</span> <span class="p">=</span> <span class="n">applicationView</span><span class="p">.</span><span class="n">TitleBar</span><span class="p">;</span> <span class="n">titleBar</span><span class="p">.</span><span class="n">ExtendViewIntoTitleBar</span> <span class="p">=</span> <span class="k">true</span><span class="p">;</span> <span class="n">titleBar</span><span class="p">.</span><span class="n">ButtonBackgroundColor</span> <span class="p">=</span> <span class="p">(</span><span class="n">Color</span><span class="p">)</span> <span class="n">Resources</span><span class="p">[</span><span class="s">&quot;LightSidebarBackgroundColor&quot;</span><span class="p">];</span> <span class="n">titleBar</span><span class="p">.</span><span class="n">ButtonForegroundColor</span> <span class="p">=</span> <span class="n">Colors</span><span class="p">.</span><span class="n">White</span><span class="p">;</span> </code></pre></div> <p>This gives me that best result for my app in my opinion, but will vary with the style and content of each app.</p> <p><a href="/content/images/posts/extend.png"><img width="600" src="/content/images/posts/extend.png"/></a></p> <h2>Conclusion</h2> <p>Now that how apps are going to be in windows a lot of the time we need to pay more attention to things like the title bar.</p> Thu, 09 Apr 2015 00:00:00 +0000 http://compiledexperience.com/blog/posts/windows-10-title-bar http://compiledexperience.com/blog/posts/windows-10-title-bar nigel.sampson@compiledexperience.com (Nigel Sampson) What's new in Windows 10 - Http Live Streaming <p>Microsoft have finally started to show off what&#39;s available in Windows 10 for us app developers. Over the next few days we can start to take a look at some of these changes and what it can mean. Today we&#39;ll look at what&#39;s available for media playback with <code>AdaptiveMediaSource</code>.</p> <h2>Disclaimer</h2> <p>This was written using the initial release of the Windows 10 Developer Tools running on Windows 10 build 10041 and things will mostly change before final release. I&#39;ll try to come back and keep these posts up to date as time goes on.</p> <h2>HTTP Live Streaming</h2> <p>There are a lot of adaptive live video streaming formats out there. The three most popular are:</p> <ol> <li><a href="http://en.wikipedia.org/wiki/HTTP_Live_Streaming">HLS</a></li> <li><a href="http://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP">MPEG-DASH</a> </li> <li><a href="http://www.iis.net/downloads/microsoft/smooth-streaming">Smooth Streaming</a></li> </ol> <p>Previously if wanted to use HLS in our Windows 8 apps we needed to use a custom media source, some of the free ones available to download were worth the cost and the better ones were pretty pricey. For the latter two we could use <a href="https://playerframework.codeplex.com/">Player Framework</a>. </p> <p>If you&#39;re doing any complex media scenarios I&#39;d still recommend <a href="https://playerframework.codeplex.com/">Player Framework</a> but if you just want to display some HTTP Live Streaming content in your app then there&#39;s a lot more in the box with <code>AdaptiveMediaSource</code>.</p> <p>To create an instance of <code>AdaptiveMediaSource</code> we use either <code>CreateFromStreamAsync</code> or <code>CreateFromUriAsync</code>.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="kt">var</span> <span class="n">hlsUri</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Uri</span><span class="p">(</span><span class="s">&quot;http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8&quot;</span><span class="p">);</span> <span class="kt">var</span> <span class="n">hlsSource</span> <span class="p">=</span> <span class="k">await</span> <span class="n">AdaptiveMediaSource</span><span class="p">.</span><span class="n">CreateFromUriAsync</span><span class="p">(</span><span class="n">hlsUri</span><span class="p">);</span> </code></pre></div> <p>This returns a <code>AdaptiveMediaSourceCreationResult</code> which includes the source and whether the manifest was able to be downloaded or what error occurred.</p> <div class="highlight"><pre><code class="language-xml" data-lang="xml"><span class="nt">&lt;MediaElement</span> <span class="na">x:Name=</span><span class="s">&quot;Media&quot;</span> <span class="nt">/&gt;</span> </code></pre></div><div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="k">if</span> <span class="p">(</span><span class="n">hlsSource</span><span class="p">.</span><span class="n">Status</span> <span class="p">==</span> <span class="n">AdaptiveMediaSourceCreationStatus</span><span class="p">.</span><span class="n">Success</span><span class="p">)</span> <span class="n">Media</span><span class="p">.</span><span class="n">SetMediaStreamSource</span><span class="p">(</span><span class="n">hlsSource</span><span class="p">.</span><span class="n">MediaSource</span><span class="p">);</span> </code></pre></div> <p>One thing to remember is that you need the <code>internetClient</code> capability declared in your appxmanifest. Lost some time trying to diagnose a result of <code>AdaptiveMediaSourceCreationStatus.ManifestDownloadFailure</code>.</p> <div class="highlight"><pre><code class="language-xml" data-lang="xml"><span class="nt">&lt;Capabilities&gt;</span> <span class="nt">&lt;Capability</span> <span class="na">Name=</span><span class="s">&quot;internetClient&quot;</span> <span class="nt">/&gt;</span> <span class="nt">&lt;/Capabilities&gt;</span> </code></pre></div> <h2>Conclusion</h2> <p>Having this functionality in the box is going to make building any sort of app that is supported by video content a lot easier, can&#39;t wait to get to using it.</p> Wed, 08 Apr 2015 00:00:00 +0000 http://compiledexperience.com/blog/posts/windows-10-live-streaming http://compiledexperience.com/blog/posts/windows-10-live-streaming nigel.sampson@compiledexperience.com (Nigel Sampson) What's new in Windows 10 - C# 6.0 <p>Microsoft have finally started to show off what&#39;s available in Windows 10 for us app developers. Over the next few days we can start to take a look at some of these changes and what it can mean. Today we&#39;ll look at what it means now we can develop with C# 6.</p> <h2>Disclaimer</h2> <p>This was written using the initial release of the Windows 10 Developer Tools running on Windows 10 build 10041 and things will mostly change before final release. I&#39;ll try to come back and keep these posts up to date as time goes on.</p> <h2>C# 6</h2> <p>While this isn&#39;t technically a Windows 10 feature it&#39;s something that will kind of slip under the radar. When we build Windows 10 apps with Visual Studio 2015 we&#39;ll have the C# 6 features available to us. There&#39;s huge list of new features, and I don&#39;t want to cover all of them just highlight a few that show up in Windows 10 / MVVM apps.</p> <h3>Null conditional operators</h3> <p>The null conditional operator reduces the amount of code you&#39;re going to need to write for null checking. Because the feature evaluates the left hand side of the <code>?.</code> only once it provides a thread safe way to invoke events like follows.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="k">protected</span> <span class="k">void</span> <span class="nf">OnPropertyChanged</span><span class="p">(</span><span class="kt">string</span> <span class="n">propertyName</span><span class="p">)</span> <span class="p">{</span> <span class="n">PropertyChanged</span><span class="p">?.</span><span class="n">Invoke</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="k">new</span> <span class="n">PropertyChangedEventArgs</span><span class="p">(</span><span class="n">propertyName</span><span class="p">));</span> <span class="p">}</span> </code></pre></div> <h3>nameof operator</h3> <p>The <code>nameof</code> operator is a simple one that provides a a string that names a program element, obvious use cases are for things like <code>ArgumentNullException</code>. However property changed notifications are another, anything that means less strings in your code is a good thing in my books.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="k">public</span> <span class="kt">string</span> <span class="n">Username</span> <span class="p">{</span> <span class="k">get</span> <span class="p">{</span> <span class="k">return</span> <span class="n">username</span><span class="p">;</span> <span class="p">}</span> <span class="k">set</span> <span class="p">{</span> <span class="n">username</span> <span class="p">=</span> <span class="k">value</span><span class="p">;</span> <span class="n">OnPropertyChanged</span><span class="p">(</span><span class="n">nameof</span><span class="p">(</span><span class="n">Username</span><span class="p">));</span> <span class="p">}</span> <span class="p">}</span> </code></pre></div> <h2>Conclusion</h2> <p>There&#39;s a lot of really cool features coming in C# 6, one of the best places to check them out is the the <a href="http://blogs.msdn.com/b/csharpfaq/archive/2014/11/20/new-features-in-c-6.aspx">C# team blog</a>. I&#39;d suggest thinking about how they&#39;ll affect your codebase and don&#39;t forget you have them available to you when building Windows 10 apps.</p> Tue, 07 Apr 2015 00:00:00 +0000 http://compiledexperience.com/blog/posts/windows-10-c-sharp-6 http://compiledexperience.com/blog/posts/windows-10-c-sharp-6 nigel.sampson@compiledexperience.com (Nigel Sampson) What's new in Windows 10 - Key Accelerators <p>Microsoft have finally started to show off what&#39;s available in Windows 10 for us app developers. Over the next few days we can start to take a look at some of these changes and what it can mean. Today we&#39;ll look at what you can do with the <code>Windows.UI.Xaml.KeyAccelerator</code> class.</p> <h2>Disclaimer</h2> <p>This was written using the initial release of the Windows 10 Developer Tools running on Windows 10 build 10041 and things will mostly change before final release. I&#39;ll try to come back and keep these posts up to date as time goes on.</p> <h2>Key Accelerator</h2> <p>Keyboard shortcuts aren&#39;t thought much about by app developers, we typically envisage our app running on a touch enabled tablet or phone. Although Windows 8 apps would run with no problems on desktop devices they weren&#39;t thought of as a target. Windows 10 by supporting <em>Desktop Mode</em> and the <em>Continuum</em> feature should drive more usage of Windows Apps on the desktop. In these scenarios we as developers should think about keyboard shortcuts and how they can increase the productivity of their users.</p> <p>So Windows 10 adds the <code>Windows.UI.Xaml.KeyAccelerator</code> class which provides a way to declare keyboard shortcuts for a <code>Windows.UI.Xaml.Controls.Page</code> in your xaml as you can see below.</p> <div class="highlight"><pre><code class="language-xml" data-lang="xml"><span class="nt">&lt;Page.KeyAccelerators&gt;</span> <span class="nt">&lt;KeyAccelerator</span> <span class="na">Key=</span><span class="s">&quot;N&quot;</span> <span class="na">KeyModifiers=</span><span class="s">&quot;Control&quot;</span> <span class="na">Pressed=</span><span class="s">&quot;OnNewProject&quot;</span> <span class="nt">/&gt;</span> <span class="nt">&lt;/Page.KeyAccelerators&gt;</span> </code></pre></div> <p>When that key combination is pressed (in this case Ctrl+N) then the <code>Pressed</code> event is invokes, it&#39;s handler looks like the following.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="k">private</span> <span class="k">void</span> <span class="nf">OnNewProject</span><span class="p">(</span><span class="n">KeyAccelerator</span> <span class="n">key</span><span class="p">,</span> <span class="kt">object</span> <span class="n">param</span><span class="p">)</span> <span class="p">{</span> <span class="p">...</span> <span class="p">}</span> </code></pre></div> <h2>Conclusion</h2> <p>Key Accelerators are a nice simple feature to implement. I&#39;d suggest as an exercise working through each of your views and determining the major commands for each and assign them a keyboard shortcut.</p> Thu, 02 Apr 2015 00:00:00 +0000 http://compiledexperience.com/blog/posts/windows-10-keyaccelerators http://compiledexperience.com/blog/posts/windows-10-keyaccelerators nigel.sampson@compiledexperience.com (Nigel Sampson) What's new in Windows 10 - Property Changed Notifications <p>Microsoft have finally started to show off what&#39;s available in Windows 10 for us app developers. Over the next few days we can start to take a look at some of these changes and what it can mean. Today we&#39;ll look at <code>DependencyProperty</code> changed notifications.</p> <h2>Disclaimer</h2> <p>This was written using the initial release of the Windows 10 Developer Tools running on Windows 10 build 10041 and things will mostly change before final release. I&#39;ll try to come back and keep these posts up to date as time goes on.</p> <h2>Property Changed Notifications</h2> <p>Most controls in Windows UAP expose events when significant changes to important properties are made. <code>TextBox</code> for instance exposes a <code>TextChanged</code> event. The trouble is that not every change is exposed that way and when they are it&#39;s through custom events, there&#39;s no reliable way to see property changed notifications across the board in a consistent way.</p> <p>Thankfully that&#39;s changed in Windows 10 with <code>DependencyObject.RegisterPropertyChangedCallback</code>. This method allows you to register a delegate that&#39;s invoked whenever the given <code>DependencyProperty</code> changes. This means that even if a control doesn&#39;t expose an event for the property you care about there&#39;s still a way to do it.</p> <p>Also because the signature of the delegate takes the <code>DependencyObject</code> and the <code>DependencyProperty</code> means that we can use this callback to register for multiple objects and properties.</p> <p>In our example we want to register when the <code>IsReadOnly</code> property of a <code>TextBox</code> changes.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="n">Username</span><span class="p">.</span><span class="n">RegisterPropertyChangedCallback</span><span class="p">(</span><span class="n">TextBox</span><span class="p">.</span><span class="n">IsReadOnlyProperty</span><span class="p">,</span> <span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">property</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> <span class="n">Debug</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">&quot;Is Read Only Changed: {0}&quot;</span><span class="p">,</span> <span class="n">Username</span><span class="p">.</span><span class="n">IsReadOnly</span><span class="p">);</span> <span class="p">});</span> </code></pre></div> <h2>Conclusion</h2> <p>Being able to subscribe to any dependency property for chnage notifications is one of those foundational features that for 95% of your projects you won&#39;t need it, but when you do you&#39;ll be incredibly thankful it&#39;s there.</p> <p>I already am.</p> Wed, 01 Apr 2015 00:00:00 +0000 http://compiledexperience.com/blog/posts/windows-10-property-changed http://compiledexperience.com/blog/posts/windows-10-property-changed nigel.sampson@compiledexperience.com (Nigel Sampson) What's new in Windows 10 - Launcher <p>Microsoft have finally started to show off what&#39;s available in Windows 10 for us app developers. Over the next few days we can start to take a look at some of these changes and what it can mean. To begin with let&#39;s look at what you can do with <code>Windows.System.Launcher</code>.</p> <h2>Disclaimer</h2> <p>This was written using the initial release of the Windows 10 Developer Tools running on Windows 10 build 10041 and things will mostly change before final release. I&#39;ll try to come back and keep these posts up to date as time goes on.</p> <h2>Launcher</h2> <p>A number of new methods were added to <code>Windows.System.Launcher</code>, previously it had the capabilities to launch files and uri&#39;s. This would open the app responsible for either that file extension or uri protocol. If none existed on the user&#39;s machine then it would prompt to open the store to download the appropriate apps. If multiple apps were installed then an application picker was displayed.</p> <h3>LaunchFolderAsync</h3> <p>You can use <code>Windows.System.Launcher.LaunchFolderAsync</code> to open the File Explorer to the folder that you specify.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="kt">var</span> <span class="n">folder</span> <span class="p">=</span> <span class="n">KnownFolders</span><span class="p">.</span><span class="n">PicturesLibrary</span><span class="p">;</span> <span class="k">await</span> <span class="n">Launcher</span><span class="p">.</span><span class="n">LaunchFolderAsync</span><span class="p">(</span><span class="n">folder</span><span class="p">);</span> </code></pre></div> <p>To use the Pictures Library ensure you have the following capability declared in <code>Package.appxmanifest</code>.</p> <div class="highlight"><pre><code class="language-xml" data-lang="xml"><span class="nt">&lt;uap:Capability</span> <span class="na">Name=</span><span class="s">&quot;picturesLibrary&quot;</span> <span class="nt">/&gt;</span> </code></pre></div> <h3>LaunchUriForResultsAsync</h3> <p>In Windows 10 there&#39;s new systems for app to app communication, one of which is a way to launch an app using a protocol and await for the launched app to return some result. This could be used for something like a third party payment processor as an app on the device or potentially social authentication. Imagine rather than launching <code>WebAuthenticationBroker</code> for logging into something like Twitter but instead the Twitter app.</p> <p>Here we use <code>TargetApplicationPackageFamilyName</code> to ensure we launch a trusted app and not some other app trying to hijack our protocol.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="kt">var</span> <span class="n">options</span> <span class="p">=</span> <span class="k">new</span> <span class="n">LauncherOptions</span> <span class="p">{</span> <span class="n">TargetApplicationPackageFamilyName</span> <span class="p">=</span> <span class="s">&quot;Desired.App_fahbwp72s5828&quot;</span> <span class="p">};</span> <span class="kt">var</span> <span class="n">result</span> <span class="p">=</span> <span class="k">await</span> <span class="n">Launcher</span><span class="p">.</span><span class="n">LaunchUriForResultsAsync</span><span class="p">(</span><span class="k">new</span> <span class="n">Uri</span><span class="p">(</span><span class="s">&quot;custom://auth?username=test&quot;</span><span class="p">),</span> <span class="n">options</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="n">result</span><span class="p">.</span><span class="n">Status</span> <span class="p">==</span> <span class="n">LaunchUriStatus</span><span class="p">.</span><span class="n">Success</span><span class="p">)</span> <span class="p">{</span> <span class="p">...</span> <span class="p">}</span> </code></pre></div> <p>On the target app end they use <code>OnActivated</code> to receive the correct activation arguments and a reference to the operation.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="k">protected</span> <span class="k">override</span> <span class="k">void</span> <span class="nf">OnActivated</span><span class="p">(</span><span class="n">IActivatedEventArgs</span> <span class="n">args</span><span class="p">)</span> <span class="p">{</span> <span class="k">if</span> <span class="p">(</span><span class="n">args</span><span class="p">.</span><span class="n">Kind</span> <span class="p">==</span> <span class="n">ActivationKind</span><span class="p">.</span><span class="n">ProtocolForResults</span><span class="p">)</span> <span class="p">{</span> <span class="kt">var</span> <span class="n">protocolArgs</span> <span class="p">=</span> <span class="p">(</span><span class="n">ProtocolForResultsActivatedEventArgs</span><span class="p">)</span> <span class="n">args</span><span class="p">;</span> <span class="kt">var</span> <span class="n">operation</span> <span class="p">=</span> <span class="n">protocolArgs</span><span class="p">.</span><span class="n">ProtocolForResultsOperation</span><span class="p">;</span> <span class="p">...</span> <span class="p">}</span> <span class="p">}</span> </code></pre></div> <p>and then when the target app is completed use the operation to report completion and hand off to the original app.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="kt">var</span> <span class="n">values</span> <span class="p">=</span> <span class="k">new</span> <span class="n">ValueSet</span> <span class="p">{</span> <span class="p">{</span> <span class="s">&quot;Success&quot;</span><span class="p">,</span> <span class="k">true</span> <span class="p">},</span> <span class="p">{</span> <span class="s">&quot;Token&quot;</span><span class="p">,</span> <span class="s">&quot;ec1b29ac-2296-4b27-8ea1-848188e83ea2&quot;</span> <span class="p">}</span> <span class="p">};</span> <span class="n">operation</span><span class="p">.</span><span class="n">ReportCompleted</span><span class="p">(</span><span class="n">values</span><span class="p">);</span> </code></pre></div> <p>You can view more on this at <a href="https://channel9.msdn.com/Series/Developers-Guide-to-Windows-10-Preview/10">Developer&#39;s Guide to Windows 10 Preview: (10) App-to-App Communication</a>.</p> <h3>QueryUriSupportAsync</h3> <p>With all this new functionality you may what to first check to see if an operation is supported. If you have a collection of apps that use protocols to communicate data then it would be better user experience if you can detect whether the other app is installed and ready to handle your protocol. </p> <p>This would also be very useful if you&#39;re trying to support third party apps such as <a href="http://www.metrotubeapp.com/">MetroTube</a>, they have a custom protocol you can use to launch their app to view YouTube videos. You can now conditionally show your <em>View in MetroTube</em> button only when their app is installed.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="kt">var</span> <span class="n">status</span> <span class="p">=</span> <span class="k">await</span> <span class="n">Launcher</span><span class="p">.</span><span class="n">QueryUriSupportAsync</span><span class="p">(</span><span class="k">new</span> <span class="n">Uri</span><span class="p">(</span><span class="s">&quot;mailto:&quot;</span><span class="p">),</span> <span class="n">LaunchUriType</span><span class="p">.</span><span class="n">LaunchUri</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="n">status</span> <span class="p">==</span> <span class="n">QueryUriSupportStatus</span><span class="p">.</span><span class="n">Success</span><span class="p">)</span> <span class="p">{</span> <span class="p">...</span> <span class="p">}</span> </code></pre></div> <h3>Settings</h3> <p>Windows Phone 8 has had this for a while but now it&#39;s universal, being able to launch into specific settings areas can increase your usability by enabling users to quickly fix issues your app is encountering.</p> <p>For instance to launch the Wi-Fi settings we use.</p> <div class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="k">await</span> <span class="n">Launcher</span><span class="p">.</span><span class="n">LaunchUriAsync</span><span class="p">(</span><span class="k">new</span> <span class="n">Uri</span><span class="p">(</span><span class="s">&quot;ms-settings://network/wifi&quot;</span><span class="p">));</span> </code></pre></div> <h2>Conclusion</h2> <p>That sums up some of the major changes to <code>Windows.System.Launcher</code>. There&#39;s a few quality of life changes but the major one is the <code>LaunchUriForResultsAsync</code> method. It will be interesting to see what developers make of this and if an ecosystem of third party apps emerges.</p> Tue, 31 Mar 2015 00:00:00 +0000 http://compiledexperience.com/blog/posts/windows-10-launcher http://compiledexperience.com/blog/posts/windows-10-launcher nigel.sampson@compiledexperience.com (Nigel Sampson) Windows 10 and Caliburn.Micro initial comments <p>As I briefly <a href="http://compiledexperience.com/blog/posts/windows-10-sdk/">mentioned yesterday</a>, the Windows 10 Technical Preview tools have been released. My first experiments were about ensuring Caliburn.Micro still works well. </p> <p>For the most part it works fine, you can read my full thoughts on the <a href="http://caliburnmicro.com/announcements/windows-10-uap-initial/">Caliburn.Micro website</a>.</p> Wed, 25 Mar 2015 00:00:00 +0000 http://compiledexperience.com/blog/posts/windows-10-caliburn-initial http://compiledexperience.com/blog/posts/windows-10-caliburn-initial nigel.sampson@compiledexperience.com (Nigel Sampson) Windows 10 SDK released <p>In a bit of surprise news (I wasn&#39;t expecting this till <a href="http://www.buildwindows.com/">Build</a>) but Microsoft have just announced the release of the <a href="http://dev.windows.com/en-US/windows-10-developer-preview-tools">Windows 10 Technical Preview Tools</a>. This will let us build and upgrade our apps to the Windows 10 Universal App Platform.</p> <p>To help you get started I&#39;d recommend checking out the <a href="https://github.com/Microsoft/Windows-universal-samples">sample apps</a> on GitHub, and the <a href="https://channel9.msdn.com/Series/Developers-Guide-to-Windows-10-Preview">Developer&#39;s Guide to Windows 10 Preview</a> on Channel 9.</p> <p>I&#39;ll start to post more of what I discover as I go through them.</p> Tue, 24 Mar 2015 00:00:00 +0000 http://compiledexperience.com/blog/posts/windows-10-sdk http://compiledexperience.com/blog/posts/windows-10-sdk nigel.sampson@compiledexperience.com (Nigel Sampson) Preventing zoom on WebView <p>In an upcoming version of <a href="http://compiledexperience.com/windows-apps/hub-bug/">Hub Bug</a> I&#39;m using an embedded WebView to display Markdown content (yay!). This works fantastically in a desktop experience, touch however is a different experience.</p> <p>Web has some peculiarities about it&#39;s layout, it won&#39;t resize to fit it&#39;s content instead it needs to be a fixed layout and to make use of it&#39;s built in scrolling for any content larger than it&#39;s current viewport.</p> <p>We can work around this issue most of the time, however part of this scrolling comes zooming which means on touch devices the user can pinch zoom your content which usually isn&#39;t something you want with an embedded WebView.</p> <p>So how do we disable this? Initially I experimented with the <code>viewport</code> with no success.</p> <div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt">&lt;meta</span> <span class="na">name=</span><span class="s">&quot;viewport&quot;</span> <span class="na">content=</span><span class="s">&quot;width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0&quot;</span><span class="nt">&gt;</span> </code></pre></div> <p>Thankfully <a href="http://www.markermetro.com/">Marker Metro</a>&#39;s resident html/js expert <a href="https://twitter.com/dkarzon">Damian Karzon</a> came to the rescue with the following css.</p> <div class="highlight"><pre><code class="language-css" data-lang="css"><span class="nt">html</span> <span class="p">{</span> <span class="o">-</span><span class="n">ms</span><span class="o">-</span><span class="k">content</span><span class="o">-</span><span class="n">zooming</span><span class="o">:</span> <span class="k">none</span><span class="p">;</span> <span class="p">}</span> </code></pre></div> <p>We now have embedded html content in the app that feels a part of the app and not that weird <em>floating on top</em>.</p> Mon, 02 Feb 2015 00:00:00 +0000 http://compiledexperience.com/blog/posts/webview-zoom http://compiledexperience.com/blog/posts/webview-zoom nigel.sampson@compiledexperience.com (Nigel Sampson) MVP ComCamp 2015 <p>I&#39;ll be speaking in a few weeks at an in person seminar here in Auckland called <a href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032610281&amp;Culture=en-AU&amp;community=0">MVP CompCamp 2015</a> on February the 10th . It&#39;s a good chance to meet and connect some of the NZ MVP&#39;s and learn some cool things on Azure and how it intersects with App development.</p> <p>You can <a href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032610281&amp;Culture=en-AU&amp;community=0">register here</a>, look forward to seeing you.</p> Fri, 23 Jan 2015 00:00:00 +0000 http://compiledexperience.com/blog/posts/comcamp-2015 http://compiledexperience.com/blog/posts/comcamp-2015 nigel.sampson@compiledexperience.com (Nigel Sampson)