<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>lmoroney</title><link>http://blogs.msdn.com/b/lmoroney/</link><description /><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>The Allure of Azure</title><link>http://blogs.msdn.com/b/lmoroney/archive/2013/04/16/the-allure-of-azure.aspx</link><pubDate>Tue, 16 Apr 2013 14:35:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10411456</guid><dc:creator>Laurence Moroney</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lmoroney/rsscomments.aspx?WeblogPostID=10411456</wfw:commentRss><comments>http://blogs.msdn.com/b/lmoroney/archive/2013/04/16/the-allure-of-azure.aspx#comments</comments><description>&lt;p&gt;Awesome infographic showing the allure of Windows Azure, the world’s most powerful cloud platform. Come check out how easy it is to cloud-enable your applications and services, and take advantage of high speed at global scale…&lt;/p&gt; &lt;!--more--&gt;&lt;img src="http://mediasvcp5lc0xlx242lz.blob.core.windows.net/blogstuff/WindowsAzureIaaSInfographic.png" width="600" height="12436" /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10411456" width="1" height="1"&gt;</description></item><item><title>Using the Bing Image of the Day in a Windows Store Application</title><link>http://blogs.msdn.com/b/lmoroney/archive/2013/04/15/using_2D00_the_2D00_bing_2D00_image_2D00_of_2D00_the_2D00_day_2D00_in_2D00_a_2D00_windows_2D00_store_2D00_application.aspx</link><pubDate>Mon, 15 Apr 2013 22:32:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10411263</guid><dc:creator>Laurence Moroney</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lmoroney/rsscomments.aspx?WeblogPostID=10411263</wfw:commentRss><comments>http://blogs.msdn.com/b/lmoroney/archive/2013/04/15/using_2D00_the_2D00_bing_2D00_image_2D00_of_2D00_the_2D00_day_2D00_in_2D00_a_2D00_windows_2D00_store_2D00_application.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/6646.image_5F00_1CCE6A86.png"&gt;&lt;img title="image" style="border-width: 0px; margin: 0px 10px 10px 5px; display: inline;" border="0" alt="image" align="left" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/4263.image_5F00_thumb_5F00_10CC7A52.png" width="204" height="129" /&gt;&lt;/a&gt; I'm a huge fan of the Bing Image of the Day, and make sure I open my browser to Bing at least once a day to see what the current image is! If you haven’t tried it – go ahead and do so. Just go to &lt;a href="http://www.bing.com"&gt;http://www.bing.com&lt;/a&gt;, and see what image is in store for you today. In this article, you’ll see how you can find this image, download it, and use it in your Windows Store application.&lt;/p&gt; &lt;!--more--&gt;  &lt;p&gt;Here’s today’s image:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/5153.bing1_5F00_509660D7.png"&gt;&lt;img title="bing1" style="border-width: 0px; display: inline;" border="0" alt="bing1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/6712.bing1_5F00_thumb_5F00_2E5E5551.png" width="540" height="335" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If you’ve ever wondered how to access this image, I’ll show you in this article. While my code is for a Windows Store application in C#, it should be easy to modify for something else. Please not that this is for tutorial purposes only, it does not grant a license to use these images in applications of your own.&lt;/p&gt;  &lt;h2&gt;Step 1. Change the App Background to an IMAGE&lt;/h2&gt;  &lt;p&gt;If you don’t have the tools to build a Windows Store App already, take a look &lt;a href="http://www.philotic.com/?p=51"&gt;here&lt;/a&gt; for a handy-dandy tutorial on how to download, install and get started with them. &lt;/p&gt;  &lt;p&gt;Using Visual Studio, create a new Windows Store App using the Blank App (XAML) template. This will give you a page called ‘MainPage.xaml’ which defines your application UI. In it you’ll find a ‘Grid.xaml’ which looks like this:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;    &amp;lt;Grid Background=&lt;span class="str"&gt;&amp;quot;{StaticResource ApplicationPageBackgroundThemeBrush}&amp;quot;&lt;/span&gt;&amp;gt;
        
    &amp;lt;/Grid&amp;gt;&lt;/pre&gt;


&lt;p&gt;Change it to use an Image as the background instead of the theme brush like this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;    &amp;lt;Grid&amp;gt;
        &amp;lt;Grid.Background&amp;gt;
            &amp;lt;ImageBrush x:Name=&lt;span class="str"&gt;&amp;quot;imgBrush&amp;quot;&lt;/span&gt; ImageSource=&lt;span class="str"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/ImageBrush&amp;gt;
        &amp;lt;/Grid.Background&amp;gt;
    &amp;lt;/Grid&amp;gt;&lt;/pre&gt;


&lt;p&gt;This gives you a brush that will paint an image on the background. It’s presently blank, but the name ‘imgBrush’ will allow you to access it in code, and from there to set it’s contents.&lt;/p&gt;

&lt;h2&gt;STEP 2. Add your Class References&lt;/h2&gt;

&lt;p&gt;The code you’ll write in later steps uses some objects that aren’t in the default namespaces provided by the application template. You’ll see all of these at the top of the code file MainPage.xaml.cs, where each line begins with the ‘using’ keyword.&lt;/p&gt;

&lt;p&gt;Add the following to make sure that the classes you need are available:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xml.Linq;
&lt;span class="kwrd"&gt;using&lt;/span&gt; Windows.Storage;
&lt;span class="kwrd"&gt;using&lt;/span&gt; Windows.Networking.BackgroundTransfer;
&lt;span class="kwrd"&gt;using&lt;/span&gt; Windows.UI.Xaml.Media.Imaging;&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;STEP 3. Create your LOADER and Call it&lt;/h2&gt;

&lt;p&gt;The template provides you with the page called ‘MainPage.xaml’, which is defined by the MainPage class. This, when you want to run something at start up, you can do it in the class constructor, which is called MainPage()&lt;/p&gt;

&lt;p&gt;In here, add a line of code so that it looks like this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; MainPage()
{  
  &lt;span class="kwrd"&gt;this&lt;/span&gt;.InitializeComponent();
  doLoadBG();
}&lt;/pre&gt;


&lt;p&gt;The function doLoadBG() is what will download the Bing Image and set it to the background of your app. &lt;/p&gt;

&lt;p&gt;Here’s what it should look like. Note that it uses the async modifier as it requires some asynchronous functionality which you’ll see in the next step.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;async &lt;span class="kwrd"&gt;void&lt;/span&gt; doLoadBG()
{
}&lt;/pre&gt;


&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Step 4. Download the BING XML and get the image URL&lt;/h2&gt;

&lt;p&gt;The XML defining the Bing Image and other functionality on the start page is here: &lt;a title="http://www.bing.com/HPImageArchive.aspx?format=xml&amp;amp;idx=0&amp;amp;n=1&amp;amp;mkt=en-US" href="http://www.bing.com/HPImageArchive.aspx?format=xml&amp;amp;idx=0&amp;amp;n=1&amp;amp;mkt=en-US"&gt;http://www.bing.com/HPImageArchive.aspx?format=xml&amp;amp;idx=0&amp;amp;n=1&amp;amp;mkt=en-US&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following code will download that XML, and then get the contents of it’s ‘url’ field. This contains the relative url of the image, so prefixing it with ‘http://www.bing.com’ will get the fill url:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;System.Xml.Linq.XDocument xmlDoc = XDocument.Load(&lt;span class="str"&gt;&amp;quot;http://www.bing.com/HPImageArchive.aspx?format=xml&amp;amp;idx=0&amp;amp;n=1&amp;amp;mkt=en-US&amp;quot;&lt;/span&gt;);
IEnumerable&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; strTest = from node &lt;span class="kwrd"&gt;in&lt;/span&gt; xmlDoc.Descendants(&lt;span class="str"&gt;&amp;quot;url&amp;quot;&lt;/span&gt;) select node.Value;
&lt;span class="kwrd"&gt;string&lt;/span&gt; strURL = &lt;span class="str"&gt;&amp;quot;http://www.bing.com&amp;quot;&lt;/span&gt; + strTest.First();&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Step 5. DOWNLOAD THE IMAGE&lt;/h2&gt;

&lt;p&gt;Now that you know the absolute URL of the image, you can download it and put it into Windows Storage. This code will create a destination file in Windows Storage, if it doesn’t already exist, and will create a BackgroundDownloader object to download the image and save it to.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;Uri source = &lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(strURL);
StorageFile destinationFile;
&lt;span class="kwrd"&gt;try&lt;/span&gt;
{
  destinationFile = await ApplicationData.Current.LocalFolder.CreateFileAsyn(&lt;span class="str"&gt;&amp;quot;downloadimage.jpg&amp;quot;&lt;/span&gt;,
      CreationCollisionOption.GenerateUniqueName);
}
&lt;span class="kwrd"&gt;catch&lt;/span&gt; (FileNotFoundException ex)
{
  &lt;span class="kwrd"&gt;return&lt;/span&gt;;
}
BackgroundDownloader downloader = &lt;span class="kwrd"&gt;new&lt;/span&gt; BackgroundDownloader();
DownloadOperation download = downloader.CreateDownload(source, destinationFile);
await download.StartAsync();
ResponseInformation response = download.GetResponseInformation();&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Step 6. Use the Image as the background&lt;/h2&gt;

&lt;p&gt;Now that you have the image in storage, it’s simply a manner of creating a URI to it’s location on your hard drive, and using this to create a new BitmapImage object. Once you have that, you can set the ImageSource of the ‘imgBrush’ background brush you created in step 1, and the background of your app will use the Bing Image of the day on the day that it loads!&lt;/p&gt;

&lt;pre class="csharpcode"&gt;Uri imageUri;
BitmapImage image = &lt;span class="kwrd"&gt;null&lt;/span&gt;;

&lt;span class="kwrd"&gt;if&lt;/span&gt; (Uri.TryCreate(destinationFile.Path, UriKind.RelativeOrAbsolute, &lt;span class="kwrd"&gt;out&lt;/span&gt; imageUri))
{
  image = &lt;span class="kwrd"&gt;new&lt;/span&gt; BitmapImage(imageUri);
}

imgBrush.ImageSource = image;&lt;/pre&gt;


&lt;p&gt;&lt;/p&gt;

&lt;p&gt;For your convenience, here’s the complete function:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;        async &lt;span class="kwrd"&gt;void&lt;/span&gt; doLoadBG()
        {
            System.Xml.Linq.XDocument xmlDoc = XDocument.Load(&lt;span class="str"&gt;&amp;quot;http://www.bing.com/HPImageArchive.aspx?format=xml&amp;amp;idx=0&amp;amp;n=1&amp;amp;mkt=en-US&amp;quot;&lt;/span&gt;);
            IEnumerable&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; strTest = from node &lt;span class="kwrd"&gt;in&lt;/span&gt; xmlDoc.Descendants(&lt;span class="str"&gt;&amp;quot;url&amp;quot;&lt;/span&gt;) select node.Value;
            &lt;span class="kwrd"&gt;string&lt;/span&gt; strURL = &lt;span class="str"&gt;&amp;quot;http://www.bing.com&amp;quot;&lt;/span&gt; + strTest.First();
            Uri source = &lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(strURL);
            StorageFile destinationFile;
            &lt;span class="kwrd"&gt;try&lt;/span&gt;
            {
                destinationFile = await ApplicationData.Current.LocalFolder.CreateFileAsync(
                    &lt;span class="str"&gt;&amp;quot;downloadimage.jpg&amp;quot;&lt;/span&gt;, CreationCollisionOption.GenerateUniqueName);
            }
            &lt;span class="kwrd"&gt;catch&lt;/span&gt; (FileNotFoundException ex)
            {

                &lt;span class="kwrd"&gt;return&lt;/span&gt;;
            }
            BackgroundDownloader downloader = &lt;span class="kwrd"&gt;new&lt;/span&gt; BackgroundDownloader();
            DownloadOperation download = downloader.CreateDownload(source, destinationFile);
            await download.StartAsync();
            ResponseInformation response = download.GetResponseInformation();
            Uri imageUri;
            BitmapImage image = &lt;span class="kwrd"&gt;null&lt;/span&gt;;

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (Uri.TryCreate(destinationFile.Path, UriKind.RelativeOrAbsolute, &lt;span class="kwrd"&gt;out&lt;/span&gt; imageUri))
            {
                image = &lt;span class="kwrd"&gt;new&lt;/span&gt; BitmapImage(imageUri);
            }
            imgBrush.ImageSource = image;
        }&lt;/pre&gt;


&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;And that’s all it takes! If you have any questions or comments, please use the fields below.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10411263" width="1" height="1"&gt;</description></item><item><title>Great, Free, Windows Phone 8 Developer Resources</title><link>http://blogs.msdn.com/b/lmoroney/archive/2013/04/10/great-free-windows-phone-8-developer-resources.aspx</link><pubDate>Wed, 10 Apr 2013 14:56:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10410022</guid><dc:creator>Laurence Moroney</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lmoroney/rsscomments.aspx?WeblogPostID=10410022</wfw:commentRss><comments>http://blogs.msdn.com/b/lmoroney/archive/2013/04/10/great-free-windows-phone-8-developer-resources.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.philotic.com/wp-content/uploads/2013/04/3rdParty_3_thumb1.png"&gt;&lt;img style="margin: 0px 10px 10px 0px; display: inline; border: 0px;" title="3rdParty_3" src="http://www.philotic.com/wp-content/uploads/2013/04/3rdParty_3_thumb1.png" alt="3rdParty_3" width="165" height="101" align="left" border="0" /&gt;&lt;/a&gt; If you&amp;rsquo;ve ever wanted to learn how to develop Windows Phone 8 apps, but didn&amp;rsquo;t know where to start, well &amp;ndash; here you go. Here&amp;rsquo;s a great set of tutorials that will jump start you into WP8 development, as well as the complete set of sessions from Build 2012 around Windows Phone 8. Enjoy! &lt;!--more--&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Windows Phone 8 Jump Start&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Recently we have the Jump Start and the full content is available at Channel9. Here is the list&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;Mod 01a: &lt;a href="http://channel9.msdn.com/Series/MVA-Jump-Start/Building-Apps-for-Windows-Phone-8-Jump-Start-01a-Introducing-Windows-Phone-8-Development-Part-1"&gt;Introducing Windows Phone 8 Development Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 01b: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-01b-Introducing-Windows-Phone-8-Development-Part-2"&gt;Introducing Windows Phone 8 Development Part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 02: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-02-Designing-Windows-Phone-8-Apps"&gt;Designing Windows Phone 8 Apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 03: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-03-Building-Windows-Phone-8-Apps"&gt;Building Windows Phone 8 Apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 04: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-04-Files-and-Storage-on-Windows-Phone-8"&gt;Files and Storage on Windows Phone 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 05: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-05-Windows-Phone-8-Application-Lifecycle"&gt;Windows Phone 8 Application Lifecycle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 06: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-06-Background-Agents"&gt;Background Agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 07: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-07-Tiles-and-Lock-Screen-Notifications"&gt;Tiles and Lock Screen Notifications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 08: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-08-Push-Notifications"&gt;Push Notifications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 09: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-09-Using-Phone-Resources-in-Windows-Phone-8"&gt;Using Phone Resources in Windows Phone 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 10: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-10-App-to-App-Communication-in-Windows-Phone-8"&gt;App to App Communication in Windows Phone 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 11: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-11-Network-Communication-in-Windows-Phone-8"&gt;Network Communication in Windows Phone 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 12: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-12-Proximity-Sensors-and-Bluetooth-in-Windows-Phone-8"&gt;Proximity Sensors and Bluetooth in Windows Phone 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 13: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-13-Speech-Input-in-Windows-Phone-8"&gt;Speech Input in Windows Phone 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 14: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-14-Maps-and-Location-in-Windows-Phone-8"&gt;Maps and Location in Windows Phone 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 15: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-15-Wallet-Support"&gt;Wallet Support&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 16: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-16-In-App-Purchasing"&gt;In-App Purchasing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 17: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-17-The-Windows-Phone-Store"&gt;The Windows Phone Store&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 18: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-18-Enterprise-App-Architecture"&gt;Enterprise App Architecture&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 19: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-19-Windows-Phone-8-and-Windows-8-Cross-Platform-Develop"&gt;Windows Phone 8 and Windows 8 Cross Platform Development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mod 20: &lt;a href="http://channel9.msdn.com/posts/Building-Apps-for-Windows-Phone-8-Jump-Start-20-Mobile-Web"&gt;Mobile Web&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;In fact if you go in any of the links it would have reference to all other materials.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Windows Phone 8 Training Kit for Developers&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=35777"&gt;http://www.microsoft.com/en-us/download/details.aspx?id=35777&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Windows Phone 8 in Build Conference 2012&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Another great resource was delivered in Build 2012 conference. The complete list is available in Phone blog and here are they&lt;/p&gt;
&lt;p&gt;Day 1&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/1-001#time=1h11m21s"&gt;Windows Phone in the day 1 keynote&lt;/a&gt; (at 1h11m21s), or see the full keynote &lt;a href="http://channel9.msdn.com/Events/Build/2012/1-001"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-013"&gt;Windows Phone 8: Application Model&lt;/a&gt;(Andrew Clinick)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/3-046"&gt;Windows Phone 8: Native C/C++ Game Development&lt;/a&gt;(Sam George)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-021"&gt;Windows Phone 8: XAML Application Development&lt;/a&gt;(Shawn Oster)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/3-043"&gt;How to Leverage your Code across WP8 and Windows 8&lt;/a&gt;(Andrew Byrne, Doug Rothaus)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-016"&gt;Windows Phone 8- In App Purchase &amp;amp; Developer Center&lt;/a&gt; (Zac Woodall, Arvind Ladha, Saral Shodhan)&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;Day 2&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/3-045"&gt;Windows Phone 8: Critical Developer Practices for Delivering Outstanding Apps&lt;/a&gt;(Stefan Wick)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/3-047"&gt;Windows Phone 8: Networking, Bluetooth, and NFC Proximity for Developers&lt;/a&gt;(Tim Laverty)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-022"&gt;Windows Phone 8: Making Money with Your Application on Windows Phone&lt;/a&gt;(Todd Brix)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-015"&gt;Windows Phone 8: HTML5/IE10 for Developers&lt;/a&gt; (Jorge Peraza, Rick Xu)&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;Day 3&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-017"&gt;Windows Phone 8: Maps, Location, and Background Execution for Developers&lt;/a&gt;(Adina Trufinescu)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/3-048"&gt;Windows Phone 8: Performance &amp;amp; Optimization for Developers&lt;/a&gt;(Oren Nachman)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-018"&gt;Windows Phone 8: Photo and Lens Apps&lt;/a&gt;(Eric Bennett)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-019"&gt;Windows Phone 8: Tiles, Lock Screen, and Notifications&lt;/a&gt;(Thomas Fennel)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/3-049"&gt;Windows Phone 8: Using C++ in your Applications&lt;/a&gt; (Peter Torr)&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;Day 4&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/3-050"&gt;Windows Phone 8: Using the Speech API&lt;/a&gt;(Avery Bishop)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-020"&gt;Windows Phone 8: Wallet and Deals for Developers&lt;/a&gt;(Matthias Baer)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/3-044"&gt;Windows Phone 8: App to App Communication&lt;/a&gt;(Sean McKenna)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-014"&gt;Windows Phone 8: Enterprise Development&lt;/a&gt;(Cliff Strom, Shawn Henry)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/Build/2012/2-031"&gt;Nokia Music Windows Phone 8 App-to-App APIs&lt;/a&gt; (Matthew Cooper, Steve Robbins)&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10410022" width="1" height="1"&gt;</description></item><item><title>Windows Store Dev Tip: Be Data Agnostic without XPath</title><link>http://blogs.msdn.com/b/lmoroney/archive/2013/04/05/windows-store-dev-tip-be-data-agnostic-without-xpath.aspx</link><pubDate>Fri, 05 Apr 2013 18:52:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10408092</guid><dc:creator>Laurence Moroney</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lmoroney/rsscomments.aspx?WeblogPostID=10408092</wfw:commentRss><comments>http://blogs.msdn.com/b/lmoroney/archive/2013/04/05/windows-store-dev-tip-be-data-agnostic-without-xpath.aspx#comments</comments><description>&lt;p&gt;I’m a big fan of using XML to select nodes from a set of XML. However, the XPath classes aren’t available to Windows Store Developers as yet, so an alternative method of getting nodes easily, without needing to understand their address at development time is very valuable to me.&lt;/p&gt;  &lt;p&gt;Linq tutorials tend to need an understanding of the makeup of the document prior to coding, but if I have a document where a node is buried in the schema, for example something like //root/TimeSeries/Days/Data/Close/Adjusted, and I just want those values, XPath is very useful because I can use the same code to get those nodes, or nodes such as //root/TimeSeries/Days/Date or something in a different part of the XML tree.&lt;/p&gt;  &lt;p&gt;The System.Xml.Linq.XDocument has a useful ‘Descendants’ method that allows me to get all the nodes that match a particular name. It’s not as powerful as XPath, but it’s still pretty good.&lt;/p&gt;  &lt;p&gt;So, for example, I can do something like this:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; strData = await client.getPriceHistoryAsStringAsync(&lt;span class="str"&gt;&amp;quot;MSFT&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;1/1/2013&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;2/1/2013&amp;quot;&lt;/span&gt;);
StringReader sRead = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringReader(strData);
XDocument xmlDoc = XDocument.Load(sRead);
var closing = from node &lt;span class="kwrd"&gt;in&lt;/span&gt; xmlDoc.Descendants(&lt;span class="str"&gt;&amp;quot;Close&amp;quot;&lt;/span&gt;) select node.Value;&lt;/pre&gt;


&lt;p&gt;This will give me a List&amp;lt;&amp;gt; containing the values of all the nodes that match “Close” in my XML Data, a snippet of which looks like this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;NewDataSet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;TimeSeries&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Date&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;2013-02-01&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Date&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Open&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;27.67&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Open&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;High&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;28.05&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;High&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Low&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;27.55&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Low&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Close&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;27.93&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Close&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Volume&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;55565900&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Volume&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;AdjClose&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;27.70&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;AdjClose&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;TimeSeries&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;TimeSeries&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Date&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;2013-01-31&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Date&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Open&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;27.79&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Open&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;High&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;27.97&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;High&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Low&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;27.40&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Low&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Close&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;27.45&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Close&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Volume&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;50530000&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Volume&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;AdjClose&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;27.22&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;AdjClose&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;TimeSeries&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;So regardless of where the &amp;lt;Close&amp;gt; values are in the schema, I get a list&amp;lt;&amp;gt; of their values with the above code, making it easy for me to chart them, and making it really easy to write a function that is data agnostic, where I can pass the node that I want to get data into the function, and use that to return the List&amp;lt;&amp;gt; of the data, like this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; getData(&lt;span class="kwrd"&gt;string&lt;/span&gt; nodeName, XDocument xmlDoc)
{
    var lReturn = from node &lt;span class="kwrd"&gt;in&lt;/span&gt; xmlDoc.Descendants(nodeName) select node.Value;
    &lt;span class="kwrd"&gt;return&lt;/span&gt; lReturn.ToList();
}&lt;/pre&gt;


&lt;p&gt;I hope this is useful to you! :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10408092" width="1" height="1"&gt;</description></item><item><title>How to convert a Web Service to an Azure Cloud Service</title><link>http://blogs.msdn.com/b/lmoroney/archive/2013/04/04/how-to-convert-a-web-service-to-an-azure-cloud-service.aspx</link><pubDate>Thu, 04 Apr 2013 22:47:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10407773</guid><dc:creator>Laurence Moroney</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lmoroney/rsscomments.aspx?WeblogPostID=10407773</wfw:commentRss><comments>http://blogs.msdn.com/b/lmoroney/archive/2013/04/04/how-to-convert-a-web-service-to-an-azure-cloud-service.aspx#comments</comments><description>&lt;p&gt;Here’s a video I shot demonstrating how to convert a simple Web Service (ASMX) to become a fully scalable Cloud Service running on Windows Azure. It’s a very straightforward process when using Visual Studio 2012.&lt;/p&gt;  &lt;div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:31ea50b5-446c-4a08-a895-cccbf79a067d" class="wlWriterEditableSmartContent" style="margin: 0px; padding: 0px; float: none; display: inline;"&gt;&lt;div&gt;&lt;object width="425" height="355"&gt;&lt;param name="movie" value="http://www.youtube.com/v/oQbMnoG56lk&amp;amp;hl=en"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/oQbMnoG56lk&amp;amp;hl=en" type="application/x-shockwave-flash" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;/div&gt;    &lt;p&gt;Here’s the YouTube &lt;a href="http://www.youtube.com/v/oQbMnoG56lk"&gt;Link&lt;/a&gt; &lt;/p&gt; Steps:   &lt;p&gt;1. Create the Cloud Service as a WCF Worker Role&lt;/p&gt;  &lt;p&gt;2. Add the method signatures of your Web Methods to the Interface Definition, and attribute them with [OperationContract]&lt;/p&gt;  &lt;p&gt;3. Add the web methods to the service implementation, removing the [WebMethod] attribution.&lt;/p&gt;  &lt;p&gt;4. Deploy.&lt;/p&gt;  &lt;p&gt;The source code for the Price History Web and Cloud Services is available here: &lt;a title="http://mediasvcp5lc0xlx242lz.blob.core.windows.net/blogstuff/PriceHistoryWebService.zip" href="http://mediasvcp5lc0xlx242lz.blob.core.windows.net/blogstuff/PriceHistoryWebService.zip"&gt;http://mediasvcp5lc0xlx242lz.blob.core.windows.net/blogstuff/PriceHistoryWebService.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10407773" width="1" height="1"&gt;</description></item><item><title>MLB.TV App now in the Windows Store</title><link>http://blogs.msdn.com/b/lmoroney/archive/2013/04/04/mlb_2D00_tv_2D00_app_2D00_now_2D00_in_2D00_the_2D00_windows_2D00_store.aspx</link><pubDate>Thu, 04 Apr 2013 17:16:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10407633</guid><dc:creator>Laurence Moroney</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lmoroney/rsscomments.aspx?WeblogPostID=10407633</wfw:commentRss><comments>http://blogs.msdn.com/b/lmoroney/archive/2013/04/04/mlb_2D00_tv_2D00_app_2D00_now_2D00_in_2D00_the_2D00_windows_2D00_store.aspx#comments</comments><description>&lt;p&gt;The Windows Store now has the app many of us have been waiting for -- the MLB.TV App. It’s a true Windows Store App, integrating some of the features that make Windows Store Applications distinct when compared with other tablet or desktop apps. &lt;/p&gt;  &lt;p&gt;First of all, my favorite feature - it incorporates Snapped and Filled views. So, if you are a Fantasy baseball geek like me, you can track your game while you watch the games on MLB.TV. &lt;/p&gt; &lt;!--more--&gt;  &lt;p&gt;So, for example, in filled view, the baseball app takes about 2/3 of the WinRT screen. I can snap an Internet Explorer view to the right of it to view my Fantasy baseball game and stats:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/0677.Screenshot71_5F00_09F84F4D.png"&gt;&lt;img title="Screenshot (7) 1" style="border-width: 0px; display: inline;" border="0" alt="Screenshot (7) 1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/1643.Screenshot71_5F00_thumb_5F00_2F81CCAE.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Or, if preferred, I can snap the MLB.TV player, and have a larger Browser view:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/4382.Screenshot81_5F00_1298A7D9.png"&gt;&lt;img title="Screenshot (8) 1" style="border-width: 0px; display: inline;" border="0" alt="Screenshot (8) 1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/8688.Screenshot81_5F00_thumb_5F00_316F1BB7.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Of course the app runs in full screen too:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/4073.Screenshot9_5F00_05521EC6.png"&gt;&lt;img title="Screenshot (9)" style="border-width: 0px; display: inline;" border="0" alt="Screenshot (9)" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/7522.Screenshot9_5F00_thumb_5F00_15EA19B4.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;A really nice feature is that you can swipe up the App Bar, and pick ‘Closed Captions’ for your video:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/3731.Screenshot13_5F00_34C08D92.png"&gt;&lt;img title="Screenshot (13)" style="border-width: 0px; display: inline;" border="0" alt="Screenshot (13)" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/2248.Screenshot13_5F00_thumb_5F00_32A38EC9.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Yep, you got it. Closed Captions for baseball in an app. That’s amazing. :)&lt;/p&gt;  &lt;p&gt;And of course, if you want to watch just the game, and not be distracted by anything, you can go full-screen with the video:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/6136.Screenshot14_5F00_0A90DFAA.png"&gt;&lt;img title="Screenshot (14)" style="border-width: 0px; display: inline;" border="0" alt="Screenshot (14)" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/2248.Screenshot14_5F00_thumb_5F00_2F41F721.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;As you can see – Closed captions work nicely in full screen too!&lt;/p&gt;  &lt;p&gt;Full Screen video also works in Filled View:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/1665.Screenshot15_5F00_2267A103.png"&gt;&lt;img title="Screenshot (15)" style="border-width: 0px; display: inline;" border="0" alt="Screenshot (15)" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/3731.Screenshot15_5F00_thumb_5F00_59CDB231.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;But of course, if you change to snapped view, the app will go out of full screen and show you the video with the tiles for scores as mentioned before.&lt;/p&gt;  &lt;p&gt;Speaking of Tiles, the App also gives you a live tile which cycles through the games that are currently in progress, with an update on their score and current inning.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/6038.Screenshot16_5F00_386E0C95.png"&gt;&lt;img title="Screenshot (16)" style="border-width: 0px; display: inline;" border="0" alt="Screenshot (16)" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/8270.Screenshot16_5F00_thumb_5F00_1133C360.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;When not watching video, the app gives you an attractive update display of what’s going on in the world of MLB today. Including, if you are not an MLB.TV subscriber an easy way to see which game is the free game of the day (in the below screenshot it’s the Tampa Bay Rays v Baltimore Orioles game, indicated by the gold highlight)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/7026.image_5F00_69F97A2A.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/1643.image_5F00_thumb_5F00_24E0ACF4.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You can choose the desired broadcast, be it the home team, away team or just the radio feed:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/5554.image_5F00_1CE90A92.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/7610.image_5F00_thumb_5F00_46E908BA.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;It also integrates really nicely with the Windows 8 Settings Charm, allowing you to do things such as specify your favorite teams:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/8270.image_5F00_0CF9C5CE.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/4885.image_5F00_thumb_5F00_4B7F1374.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;And if you configure favorites (mine are the Mariners, Dodgers and Red Sox), the app will bubble games involving those teams to the top of the list, and put a little ‘star’ on them to draw your attention to it. [The Dodgers aren’t playing on the day I wrote this, so only the Mariners and Red Sox games are shown]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/1830.image_5F00_03515798.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/0763.image_5F00_thumb_5F00_6E132C22.png" width="540" height="306" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Bottom line: If you are a baseball fan, like me, this app is a Must-Have. I have used MLB.TV app on Android, iOS, XBox and now Windows 8, and this is definitely the best of the bunch.&lt;/p&gt;  &lt;p&gt;If you have a Windows 8 device, you could do a lot worse than download and use this free app!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10407633" width="1" height="1"&gt;</description></item><item><title>Visual Studio’s Red Squigglies</title><link>http://blogs.msdn.com/b/lmoroney/archive/2013/03/21/visual_2D00_studios_2D00_red_2D00_squigglies.aspx</link><pubDate>Thu, 21 Mar 2013 20:50:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10404339</guid><dc:creator>Laurence Moroney</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lmoroney/rsscomments.aspx?WeblogPostID=10404339</wfw:commentRss><comments>http://blogs.msdn.com/b/lmoroney/archive/2013/03/21/visual_2D00_studios_2D00_red_2D00_squigglies.aspx#comments</comments><description>&lt;p&gt;Here’s a great video for VS developers. Code snippets are an easy way to get quick answers to your app development challenges, but often Visual Studio litters the new code with red squigglies that will stop you from building. &lt;/p&gt; &lt;!--more--&gt;  &lt;p&gt;You could fix them the hard way, but @WSDevSol 's own @robcap shares with you shortcuts to clean them up quickly and get back to what you love (which is presumably not cleaning up build errors.)&lt;/p&gt;  &lt;div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:855780e9-a4a9-4401-aac7-9890b55ec2f0" class="wlWriterEditableSmartContent" style="margin: 0px; padding: 0px; float: none; display: inline;"&gt;&lt;div&gt;&lt;object width="425" height="355"&gt;&lt;param name="movie" value="http://www.youtube.com/v/UOdpUKfP71A&amp;amp;hl=en"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/UOdpUKfP71A&amp;amp;hl=en" type="application/x-shockwave-flash" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10404339" width="1" height="1"&gt;</description></item><item><title>Using PDF in Windows Store Apps</title><link>http://blogs.msdn.com/b/lmoroney/archive/2013/03/13/using_2D00_pdf_2D00_in_2D00_windows_2D00_store_2D00_apps.aspx</link><pubDate>Wed, 13 Mar 2013 20:36:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10402105</guid><dc:creator>Laurence Moroney</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lmoroney/rsscomments.aspx?WeblogPostID=10402105</wfw:commentRss><comments>http://blogs.msdn.com/b/lmoroney/archive/2013/03/13/using_2D00_pdf_2D00_in_2D00_windows_2D00_store_2D00_apps.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/3326.image_5F00_6B616211.png"&gt;&lt;img title="image" style="margin: 0px 5px 5px 0px; border: 0px currentcolor; display: inline;" border="0" alt="image" align="left" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/2821.image_5F00_thumb_5F00_7933A80C.png" width="132" height="134" /&gt;&lt;/a&gt;One question I get a lot is about using document types in Windows Store Apps, and most commonly the question is around how one can use PDF documents. In this tutorial, I’ll show you how.!&lt;/p&gt; &lt;!-- more --&gt;  &lt;p&gt;The Windows Store SDK doesn’t ship with any controls for using PDFs, but fortunately, the vibrant third party ecosystem has stepped up, and ComponentOne have a very nice PDF Viewer control that may be used to quickly and easily integrate documents into your Windows Store apps.&lt;/p&gt;  &lt;p&gt;To get started, visit their download pages for WinRT XAML controls here: &lt;a title="http://www.componentone.com/SuperProducts/StudioWinRTXAML/" href="http://www.componentone.com/SuperProducts/StudioWinRTXAML/"&gt;http://www.componentone.com/SuperProducts/StudioWinRTXAML/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;They have a trial version that you can download and test, with a ‘nag screen’ that shows upon first load. After that, the control appears to be fully functional, so you can do a full eval and test before you commit to buying.&lt;/p&gt;  &lt;p&gt;Once you’ve downloaded and installed, launch Visual Studio 2012 and start creating a Windows Store App. If you’ve never done this before, check out my tutorial here: &lt;a title="http://www.philotic.com/?p=51" href="http://www.philotic.com/?p=51"&gt;http://www.philotic.com/?p=51&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Step 1. Create a New Windows Store App&lt;/h3&gt;  &lt;p&gt;From Visual Studio, on the File Menu, select ‘New Project’ and in the dialog, select ‘Windows Store’ as the App type, create a Blank App, and call it ‘PDFViewer’ like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/0777.image_5F00_401CCB0A.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/7624.image_5F00_thumb_5F00_2001BE4D.png" width="540" height="375" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Visual Studio will create a new App for you. In the next step you’ll add the references that allow you to use ComponentOne’s software to extend your tool suite.&lt;/p&gt;  &lt;h3&gt;Step 2. Add the ComponentOne Controls&lt;/h3&gt;  &lt;p&gt;In Solution Explorer, on the top right of your work bench, you’ll see a folder that says ‘References’. Right click on this, and in the pop up menu, you’ll see an option to ‘Add Reference…’&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/6138.image_5F00_6AF52F1C.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/7608.image_5F00_thumb_5F00_5FCBA4D2.png" width="517" height="425" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Select this, and the ‘Reference Manager’ popup window will appear. In this you should open the Windows-&amp;gt;Extensions folder:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/3007.image_5F00_58AC685A.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/2402.image_5F00_thumb_5F00_38915B9D.png" width="526" height="211" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You should see ‘ComponentOne Studio for WinRT XAML’ listed as shown. Click in the column to its left and make sure that the checkbox is shown and checked as above. Press OK and you’re now ready to add PDF functionality to your app.&lt;/p&gt;  &lt;h3&gt;Step 3. Add the PDF Control&lt;/h3&gt;  &lt;p&gt;The PDF control is a XAML control, so in order to add it to your App you’ll need to edit your XAML design. This is very easy to do! First, look at your Solution Explorer and find ‘MainPage.xaml’. Double click it to open it.&lt;/p&gt;  &lt;p&gt;Then, make sure you can see the Toolbox. Do this by selecting ‘ToolBox’ on the View Menu, or pressing CTRL-W followed by X.&lt;/p&gt;  &lt;p&gt;The PDF Viewer Control is called ‘C1PdfViewer’. You should see it in your Toolbox in the ‘C1 XAML Controls’ folder, like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/7282.image_5F00_6A88FC27.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/5148.image_5F00_thumb_5F00_31721F25.png" width="525" height="254" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now, simply drag and drop this to the design surface for MainPage.xaml. You’ll see XAML that looks something like this in the XAML Editor after doing so:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;PdfViewer:C1PdfViewer&lt;/span&gt; &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;281,137,0,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Xaml:C1NagScreen&lt;/span&gt;.&lt;span class="attr"&gt;Nag&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;If there is a Margin= attribute as above, delete it. Do the same for any alignment attributes. Then, add an x:Name attribute, and set it to ‘PDF1’ so that the code looks like this:&lt;/p&gt;


&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;PdfViewer:C1PdfViewer&lt;/span&gt; &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;PDF1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Xaml:C1NagScreen&lt;/span&gt;.&lt;span class="attr"&gt;Nag&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;This will allow the PDF Viewer to take up the entire size of the app. Of course when you build your app, it doesn’t have to be full screen, and you can lay it out as you like. The x:Name attribute sets the name of the control as you will refer to it in code. If you don’t use PDF1, as shown, remember your setting – you’ll need it in the next step.&lt;/p&gt;

&lt;p&gt;[Note that the Xaml:C1NagScreen.Nag tag will go away with a registered edition of the controls. Delete it in the trial and it will automatically come back.]&lt;/p&gt;

&lt;p&gt;In the next step, you’ll add a PDF to your solution, and write code to load it.&lt;/p&gt;

&lt;h3&gt;Step 4. Load a PDF Document&lt;/h3&gt;

&lt;p&gt;To make things a little simpler, you’ll add a PDF document as an embedded document to your solution. You’ll load this document directly when the app starts up. It uses a System.IO.Stream to load the document, so adapting this code to load a PDF from the file system, or from a remote server should be very easy. If you need a follow-up article to show how to do this, let me know in the comments section below.&lt;/p&gt;

&lt;p&gt;To add a document, right click on the project, and select the ‘Add’ menu, followed by the ‘Existing Item..’ entry. This will give you a file dialog that you can use to select the PDF. Next, you should make sure that the PDF you just added is treated as an Embedded Resource. Select it in ‘Solution Explorer’ and look at the ‘Properties’ window. The ‘Build Action’ setting should be ‘Embedded Resource’ like this:&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/1030.image_5F00_11571268.png"&gt;&lt;img title="image" style="margin: 0px; border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/2500.image_5F00_thumb_5F00_58403565.png" width="312" height="349" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, writing code to load the PDF is very straightforward.&lt;/p&gt;

&lt;p&gt;Open MainPage.xaml.cs. At the top of the page, with the rest of the ‘using’ statements, add:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Reflection;&lt;/pre&gt;


&lt;p&gt;Then, update the Public MainPage() function to look like this:&lt;/p&gt;


&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; MainPage()
{
  &lt;span class="kwrd"&gt;this&lt;/span&gt;.InitializeComponent();
  Assembly asm = &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(MainPage).GetTypeInfo().Assembly;
  Stream stream = asm.GetManifestResourceStream(&lt;span class="str"&gt;&amp;quot;PDFViewer.LegendOfTheLocust_Final_3D.pdf&amp;quot;&lt;/span&gt;);
  PDF1.LoadDocument(stream);
}&lt;/pre&gt;


&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;This code gets a reference to the assembly (the compiled app) and pulls the&amp;#160; PDF file out of it as a stream. It then calls the &lt;strong&gt;LoadDocument&lt;/strong&gt; method of the PDF control to load this stream. If you have a stream already, for example loaded from a remote server, you’ll only need that code and the PDF1.LoadDocument.&lt;/p&gt;

&lt;p&gt;In the next step, you’ll see how this runs, using the Windows Simulator, where you can explore its workings with multi-touch, zoom and more.&lt;/p&gt;

&lt;h3&gt;Step 5. Running and Testing the PDF Viewer&lt;/h3&gt;

&lt;p&gt;If you aren’t using a touch screen or tablet for development, a good way to test your app is to use the Windows Simulator. You can do this by changing your run target from ‘Local Machine’. Look at the toolbar in Visual Studio, and you’ll see the run control with the run target beside it:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/5732.image_5F00_2333A635.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/8284.image_5F00_thumb_5F00_180A1BEB.png" width="310" height="69" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In this case, it clearly says ‘Local Machine’. Drop the little arrow beside ‘Local Machine’ down, and you’ll see a menu containing Local Machine, Remote Machine and Simulator. Select Simulator, and you’ll see this:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/8688.image_5F00_4A01BC75.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/2821.image_5F00_thumb_5F00_3ED8322B.png" width="308" height="61" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now, press the green ‘Run’ button, and the simulator will launch with your app, and your PDF ready to read.&lt;/p&gt;

&lt;p&gt;You can see the default view, with the tablet in landscape mode, and the PDF centered according it’s aspect ratio:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/5557.image_5F00_70CFD2B5.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/2818.image_5F00_thumb_5F00_5E870BF3.png" width="533" height="330" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;When you change to landscape mode, the aspect ratio changes for better readability:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/1832.image_5F00_42764D08.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/0841.image_5F00_thumb_5F00_50489303.png" width="357" height="577" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The PDF control allows you to zoom in and out of the document using pinch gestures. These are also supported in the emulator. Instructions on how to use the emulator to do that are here: &lt;a title="http://msdn.microsoft.com/library/windows/apps/hh441475.aspx" href="http://msdn.microsoft.com/library/windows/apps/hh441475.aspx"&gt;http://msdn.microsoft.com/library/windows/apps/hh441475.aspx&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Here’s an example of having zoomed out of the document using a pinching gesture:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/8863.image_5F00_622526D0.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/0434.image_5F00_thumb_5F00_6FF76CCB.png" width="352" height="569" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;As you can see it’s very straightforward to add PDF support to your Windows Store Apps using ComponentOne’s control. 
  &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;If you have any questions, comments or feedback, let me know in the comments area below.&lt;/p&gt;

&lt;p&gt;Source Code for this article &lt;a href="http://mediasvcp5lc0xlx242lz.blob.core.windows.net/blogstuff/PDFViewer.zip" target="_blank"&gt;can be downloaded here&lt;/a&gt;.&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;

&lt;p&gt;[Sorry, book not included, but you can &lt;a href="http://www.amazon.com/gp/product/B00A5DCCKI/ref=as_li_ss_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=B00A5DCCKI&amp;amp;linkCode=as2&amp;amp;tag=lamoswenebl-20&amp;quot;&amp;gt;The Legend of The Locust&amp;lt;/a&amp;gt;&amp;lt;img src=&amp;quot;http://www.assoc-amazon.com/e/ir?t=lamoswenebl-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=B00A5DCCKI" target="_blank"&gt;The Legend of The LocustThe Legend of The Locustbuy it on Amazon&lt;/a&gt;, but there’s a different, fun, PDF in the download for you to read :)]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10402105" width="1" height="1"&gt;</description></item><item><title>Developers – Get Halo 4, and Windows Store Registration for Free!</title><link>http://blogs.msdn.com/b/lmoroney/archive/2013/02/12/developers-get-halo-4-and-windows-store-registration-for-free.aspx</link><pubDate>Tue, 12 Feb 2013 20:23:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10393092</guid><dc:creator>Laurence Moroney</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lmoroney/rsscomments.aspx?WeblogPostID=10393092</wfw:commentRss><comments>http://blogs.msdn.com/b/lmoroney/archive/2013/02/12/developers-get-halo-4-and-windows-store-registration-for-free.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/7356.image_5F00_0BAC0ADE.png"&gt;&lt;img title="image" style="margin: 0px 15px 0px 25px; display: inline;" border="0" alt="image" align="right" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/8551.image_5F00_thumb_5F00_5948375E.png" width="129" height="159" /&gt;&lt;/a&gt;Developers, did you know that if you build a Windows 8 or a Windows Phone 8 app, and publish it during the registration period (December 20, 2012 – February 28, 2013), you are eligible to get your fees reimbursed &lt;em&gt;and&lt;/em&gt; a copy of Halo 4 for Xbox 360?&lt;/p&gt;  &lt;p&gt;Details are at: &lt;a title="http://www.generationapp.com/ultimateexperience#fbid=49Ll8brAFYB" href="http://www.generationapp.com/ultimateexperience#fbid=49Ll8brAFYB"&gt;http://www.generationapp.com/ultimateexperience#fbid=49Ll8brAFYB&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Publishing your apps in these stores will give you the ability to make some serious coin from Windows 8 and Windows Phone users. And now you can do it at no risk – your fees will be reimbursed.&lt;/p&gt;  &lt;p&gt;To get started, you can follow these tutorials:&lt;/p&gt;  &lt;p&gt;Getting Started with Windows 8 Development: &lt;a title="http://www.philotic.com/?p=51" href="http://www.philotic.com/?p=51"&gt;http://www.philotic.com/?p=51&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Getting Started with Windows Phone Development: &lt;a title="http://www.philotic.com/?p=55" href="http://www.philotic.com/?p=55"&gt;http://www.philotic.com/?p=55&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I’ve also got lots of hands-on labs and tutorials that you can follow. Ping me and I’ll hook you up.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10393092" width="1" height="1"&gt;</description></item><item><title>Build a Windows Phone 8 App for Stock Market Analysis and Future Prediction</title><link>http://blogs.msdn.com/b/lmoroney/archive/2013/02/11/build_2D00_a_2D00_windows_2D00_phone_2D00_8_2D00_app_2D00_for_2D00_stock_2D00_market_2D00_analysis_2D00_and_2D00_future_2D00_prediction.aspx</link><pubDate>Mon, 11 Feb 2013 21:00:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10392763</guid><dc:creator>Laurence Moroney</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lmoroney/rsscomments.aspx?WeblogPostID=10392763</wfw:commentRss><comments>http://blogs.msdn.com/b/lmoroney/archive/2013/02/11/build_2D00_a_2D00_windows_2D00_phone_2D00_8_2D00_app_2D00_for_2D00_stock_2D00_market_2D00_analysis_2D00_and_2D00_future_2D00_prediction.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/6740.image_5F00_12933BC0.png"&gt;&lt;img title="image" style="margin: 10px; border: 0px currentcolor; display: inline;" border="0" alt="image" align="left" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/4606.image_5F00_thumb_5F00_72782F02.png" width="106" height="188" /&gt;&lt;/a&gt;In this article I’ll take you, step by step, through everything you need to do to build, run, and test a real-world Windows Phone 8 app that’s useful while also being fun and interesting. You’ll build an app that downloads data about the trading prices for a stock ticker that your user enters, performs an analysis on the current price of the stock relative to its historic price using a ‘trading bands’ technique, makes a judgment on the purchase opportunity of the stock at the moment, and renders this as a color.&lt;/p&gt; &lt;!--more--&gt;  &lt;p&gt;Before you get started, you’ll need a Windows 8 development environment set up and ready to go. This article ‘&lt;a href="http://www.philotic.com/?p=55"&gt;Getting Started with Windows Phone 8 Development’&lt;/a&gt; is a good place to start. It guides you through getting the tools and installing and making sure that they work.&lt;/p&gt;  &lt;h1&gt;Step 1.&amp;#160; Create the UI&lt;/h1&gt;  &lt;p&gt;For the tutorial, I’m keeping the UI of the app as simple as possible. It’s up to you to replace this with something a bit more polished! The UI will simply be a TextBox where the user can type the ticker for their desired stock, a button that they will press to begin the action of downloading and analyzing the price history for the stock, and a rectangle where the color for the analysis will be returned.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Generally stock applications have a primitive color visualization of red or green, where red means the stock price has gone down in the last trade, and green means it has gone up. This is &lt;strong&gt;not&lt;/strong&gt; a good indicator of whether it’s a good opportunity at this moment to purchase the stock. The app you’ll build in this article is much more sophisticated – analysing historic trends, and making a judgement as to whether the current price is a good opportunity to buy (green, with higher intensity indicating better opportunity) or a good opportunity to avoid buying (or sell if you have it), in red, with a higher intensity meaning that it’s time to avoid, or sell.&lt;/p&gt;  &lt;p&gt;Create a new Windows Phone 8 app in Visual Studio, and edit the ContentPanel grid in MainPage.xaml to have this code:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt; &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ContentPanel&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Grid&lt;/span&gt;.&lt;span class="attr"&gt;Row&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;12,0,12,0&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Button&lt;/span&gt; &lt;span class="attr"&gt;Content&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Analyze&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Click&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Button_Click_1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;13,83,0,0&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Rectangle&lt;/span&gt; &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;heatView&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Fill&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;#FFF4F4F5&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;306&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;25,150,0,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Stroke&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Black&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;406&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;TextBox&lt;/span&gt; &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;txtTicker&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;HorizontalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;72&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;13,11,0,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;TextWrapping&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Wrap&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MSFT&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;402&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;

        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;You’ll see that Button has a click event called ‘Button_Click_1’, so we’ll see how to implement the code behind that in the next step.&lt;/p&gt;

&lt;h1&gt;Step 2. Download the Price History Data&lt;/h1&gt;

&lt;p&gt;When the user presses the button, the App will download Price History data for the stock indicated by the ticker that they entered in the TextBox. The Windows Phone 8 SDK provides a ‘WebClient’ class for this functionality. It’s in the System.Net namespace. &lt;/p&gt;

&lt;p&gt;WebClient gives you an asynchronous download mechanism whereby you tell it to download data, and it calls you back once the data is done. &lt;/p&gt;

&lt;p&gt;The data itself will come from Yahoo in CSV (Comma Separated Value) format. To get the data for any stock, you simply call the following URL (for example for Microsoft MSFT):&lt;/p&gt;

&lt;p&gt;&lt;a title="http://ichart.finance.yahoo.com/table.csv?s=MSFT" href="http://ichart.finance.yahoo.com/table.csv?s=MSFT" target="_blank"&gt;http://ichart.finance.yahoo.com/table.csv?s=MSFT&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, upon the button press, you’d have the following code:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Button_Click_1(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
        {
            WebClient wc = &lt;span class="kwrd"&gt;new&lt;/span&gt; WebClient();
            &lt;span class="kwrd"&gt;string&lt;/span&gt; strTicker = txtTicker.Text;
            wc.OpenReadCompleted += wc_OpenReadCompleted;
            wc.OpenReadAsync(&lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(&lt;span class="str"&gt;&amp;quot;http://ichart.finance.yahoo.com/table.csv?s=&amp;quot;&lt;/span&gt; + strTicker));
           
        }&lt;/pre&gt;


&lt;p&gt;Now, upon pressing the button, your phone will go out and download the CSV data for the stock, and call back to wc_OpenReadCompleted when it’s done. You’ll see how to parse the data from that in the next step.&lt;/p&gt;

&lt;h1&gt;Step 3. Parse the Price History Data&lt;/h1&gt;

&lt;p&gt;The data you get back from the Yahoo Price History service is Comma Separated Values which look like this:&lt;/p&gt;

&lt;p&gt;Date,Open,High,Low,Close,Volume,Adj Close 
  &lt;br /&gt;2013-01-31,27.79,27.97,27.40,27.45,50530000,27.45 

  &lt;br /&gt;2013-01-30,28.01,28.19,27.76,27.85,43580&lt;/p&gt;

&lt;p&gt;The first line in the file is the columns, where each value is divided by a comma. Each line then has the corresponding data for that column. So, in this case there are 7 columns (Date, Open, High, Low, Close, Volume, Adjusted Close), and each line of data has 7 values, one for each of the columns. &lt;/p&gt;

&lt;p&gt;This makes parsing the data quite easy. So, for example if you want the Adjusted close price for the stock, you simply read each line as a string, split it based on the ‘,’ character, and take the 7th item. It’ll be a string, so convert it to a number.&lt;/p&gt;

&lt;p&gt;One way to do this is as follows:&lt;/p&gt;

&lt;p&gt;Create a List&amp;lt;double&amp;gt; to hold the closing prices:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;List&amp;lt;Double&amp;gt; ClosingPrices = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;double&lt;/span&gt;&amp;gt;();&lt;/pre&gt;


&lt;p&gt;I put this as a module level variable so it can be shared among functions.&lt;/p&gt;

&lt;p&gt;Then, populate this with the closing values upon wc_OpenReadCompleted firing:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; wc_OpenReadCompleted(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, OpenReadCompletedEventArgs e)
{
  &lt;span class="rem"&gt;// Clear the List&amp;lt;&amp;gt; of closing prices&lt;/span&gt;
  ClosingPrices.Clear();
  &lt;span class="rem"&gt;// We're going to keep a total of all stock closing prices to be used later in the analytics&lt;/span&gt;
  nTotal = 0;
  &lt;span class="rem"&gt;// WebClient returns a Stream, so load this into a Stream variable&lt;/span&gt;
  System.IO.Stream yData = e.Result;
  &lt;span class="rem"&gt;// Read the stream with a stream reader&lt;/span&gt;
  System.IO.StreamReader sRead = &lt;span class="kwrd"&gt;new&lt;/span&gt; System.IO.StreamReader(yData);
  &lt;span class="rem"&gt;// The first line is the headers. Read it and throw it away &lt;/span&gt;
  &lt;span class="kwrd"&gt;string&lt;/span&gt; strHeaders = sRead.ReadLine();
  &lt;span class="rem"&gt;// Read the first line of data&lt;/span&gt;
  &lt;span class="kwrd"&gt;string&lt;/span&gt; strValues = sRead.ReadLine();
  &lt;span class="kwrd"&gt;int&lt;/span&gt; rowsCounted = 0;
  &lt;span class="rem"&gt;// Read 120 lines of data (4 months) unless there are less than 4 months worth&lt;/span&gt;
  &lt;span class="kwrd"&gt;while&lt;/span&gt; ( (strValues != &lt;span class="kwrd"&gt;null&lt;/span&gt;) &amp;amp;&amp;amp; (rowsCounted &amp;lt; 120) )
  {
    &lt;span class="rem"&gt;// Split the line of data based on the comma character&lt;/span&gt;
    &lt;span class="kwrd"&gt;string&lt;/span&gt;[] Columns = strValues.Split(&lt;span class="str"&gt;','&lt;/span&gt;);
    &lt;span class="rem"&gt;// We count from zero, so even though the character is in the 7th column, it's element 6 in the array&lt;/span&gt;
    Double closing = Convert.ToDouble(Columns[6]);
    &lt;span class="rem"&gt;// Add it to Closing Prices&lt;/span&gt;
    ClosingPrices.Add(closing);
    &lt;span class="rem"&gt;// Update the total with today's closing price&lt;/span&gt;
    nTotal += closing;
    &lt;span class="rem"&gt;// Read the next line&lt;/span&gt;
    strValues = sRead.ReadLine();
    &lt;span class="rem"&gt;// Update the rows we've counted&lt;/span&gt;
    rowsCounted++; 
  }&lt;/pre&gt;


&lt;p&gt;I’ve commented each line to make it clear what it does, but it’s pretty simple – it simply reads through the first 120 lines of the data, pulls the 7th column out, converts it to a double and puts it in the List&amp;lt;double&amp;gt; you created earlier. You could, of course, do more than 120 lines (approximately 4 months worth of data), to get a better historic picture, it’s up to you.&lt;/p&gt;

&lt;p&gt;Once you have the data, it’s time to analyze it. You’ll see that in the next step.&lt;/p&gt;

&lt;h1&gt;Step 4. Calculate the trading bands.&lt;/h1&gt;

&lt;p&gt;One method of stock price analysis that is surprisingly reliable for judging performance is to take a look at a stock’s trading bands over time. These bands are drawn up based on its lows and highs, and will typically give you a good idea for how the stock will perform in the future. Like with everything else, they’re just an indicator, so please don’t consider this to be investment advice!&lt;/p&gt;

&lt;p&gt;A picture’s worth a thousand words, so here’s an example of trading bands calculated using the ‘bollinger band’ technique:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/6825.image_5F00_246FCF8D.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/1157.image_5F00_thumb_5F00_0454C2D0.png" width="540" height="205" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The concept is simple – if the current price is at the bottom of the band, it’s generally a good time to buy. If it is near the top, it’s generally a good time to sell. So, for example, this stock was at around 700 in mid September, which would have been a really good time to sell according to this analytic. And it works out right, because within 2 months it had fallen about 20%. Likewise in mid November it was at about 520, and near the bottom, and within a couple of weeks it was close to 580, and near the top, which is a nice profit one could make in 2 weeks!&lt;/p&gt;

&lt;p&gt;These bands are surprisingly easy to calculate – the upper band is 2 standard deviations above the moving average and the lower band is 2 standard deviations below it.&lt;/p&gt;

&lt;p&gt;This app isn’t going to calculate the full trading band over time, but just what the values would be today, so it takes the average stock price over the last 120 days (or however many days it read), and figures out what the high and low band for them would be.&lt;/p&gt;

&lt;p&gt;Here’s the code:&lt;/p&gt;

&lt;pre class="csharpcode" style="width: 538px; height: 252px;"&gt;&lt;span class="rem"&gt;// We kept a total, so the average is the total divided by the amount&lt;/span&gt;
Double nAverage = nTotal / ClosingPrices.Count();

&lt;span class="rem"&gt;// Calculate the standard deviation&lt;/span&gt;
Double sum = 0.0;
&lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0; i &amp;lt; ClosingPrices.Count; i++)
{
  sum += Math.Pow(ClosingPrices[i] - nAverage, 2);
}
Double nDeviation = Math.Sqrt(sum / (ClosingPrices.Count - 1));

&lt;span class="rem"&gt;// Top bollinger is Average + 2xSTD&lt;/span&gt;
Double bollingerTop = nAverage + (2 * nDeviation);
&lt;span class="rem"&gt;// Bottom bollinger is Average - 2xSTD&lt;/span&gt;
Double bollingerBottom = nAverage - (2 * nDeviation);&lt;/pre&gt;


&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Now that we have the trading envelope for today, and we know today’s closing price, let’s figure out where we are relative to the bottom band. Let’s normalize this so that it’s a value between 0 and 1, where 0 means we’re right at the bottom of the band, and 1 means we’re right at the top.&lt;/p&gt;

&lt;pre class="csharpcode" style="width: 543px; height: 289px;"&gt;&lt;span class="rem"&gt;// Top bollinger is Average + 2xSTD&lt;/span&gt;
Double bollingerTop = nAverage + (2 * nDeviation);

&lt;span class="rem"&gt;// Bottom bollinger is Average - 2xSTD&lt;/span&gt;
Double bollingerBottom = nAverage - (2 * nDeviation);

&lt;span class="rem"&gt;// Today's price is the first one we read&lt;/span&gt;
Double bCloseToday = ClosingPrices[0];

&lt;span class="rem"&gt;// Range is the width of the envelope&lt;/span&gt;
Double range = bollingerTop - bollingerBottom;

&lt;span class="rem"&gt;// Value is how high we are above the bottom&lt;/span&gt;
Double &lt;span class="kwrd"&gt;value&lt;/span&gt; = bCloseToday - bollingerBottom;

&lt;span class="rem"&gt;// If we device the value by the range, we have a normalized indicator of where we are in the envelope&lt;/span&gt;
Double score = (&lt;span class="kwrd"&gt;value&lt;/span&gt; / range);&lt;/pre&gt;


&lt;p&gt;So now that we have the score, we can turn that into a color, you’ll see that in the next step.&lt;/p&gt;

&lt;h1&gt;Step 5. Visualizing the Score with Color&lt;/h1&gt;

&lt;p&gt;We want to use Green to show that today’s price is good for buying, and Red is bad for buying (or conversely good for selling).&lt;/p&gt;

&lt;p&gt;Colors are represented using RGB values, with R=Red level, G=Green level and B=Blue level. Each level has 256 values in 24-bit color, so the ‘brightest’ red will be 0xFF0000, and the ‘brightest’ green will be 0x00FF00.&lt;/p&gt;

&lt;p&gt;So, if our score for today’s stock price relative to the trading envelope is 0, we are at the bottom of the band, so we should paint the rectangle 0x00FF00, and if it is 1, we are at the top of the band, and we paint the rectangle with 0xFF0000. &lt;/p&gt;

&lt;p&gt;Of course we are likely in between the two, so we want to map our current value to something between 0xFF0000 and 0x00FF00 to give an ‘intensity level’.&lt;/p&gt;

&lt;p&gt;Here’s the code to do this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;// This is the bottom value (Green)&lt;/span&gt;
Double heatVal = 0x00FF00; &lt;span class="rem"&gt;// (0x00FF00)&lt;/span&gt;

&lt;span class="rem"&gt;// This is the heat range, i.e. the difference between red and green&lt;/span&gt;
&lt;span class="kwrd"&gt;long&lt;/span&gt; heatRange = 0xFF0000 - 0x00FF00; &lt;span class="rem"&gt;// Red is 0xFF0000, Green is 0x00FF00. Subtract one from the other to get the range.&lt;/span&gt;
            
&lt;span class="rem"&gt;// Our value is then the bottom value plus the amount of the range we should move 'up' by&lt;/span&gt;
&lt;span class="rem"&gt;// So, for example if our score was 0, we'd stay at green. If our score is at .5 we'd move up to the half way point&lt;/span&gt;
&lt;span class="rem"&gt;// between Red and Green, which would be Green + half the range between red+green etc.&lt;/span&gt;
heatVal += heatRange * score;

&lt;span class="rem"&gt;// Now that we have our color, how do we turn it into a brush?&lt;/span&gt;
&lt;span class="kwrd"&gt;long&lt;/span&gt; heatValBits = (&lt;span class="kwrd"&gt;long&lt;/span&gt;)heatVal;

&lt;span class="rem"&gt;// Here's the red value -- shift the bits 0x10 to the right and AND them with FF&lt;/span&gt;
&lt;span class="kwrd"&gt;byte&lt;/span&gt; redByte = (&lt;span class="kwrd"&gt;byte&lt;/span&gt;) ((heatValBits &amp;gt;&amp;gt; 0x10) &amp;amp; 0xFFL);

&lt;span class="rem"&gt;// here's the green value -- shift the bits 0x08 to the right and AND them with FF&lt;/span&gt;
&lt;span class="kwrd"&gt;byte&lt;/span&gt; greenByte = (&lt;span class="kwrd"&gt;byte&lt;/span&gt;) ((heatValBits &amp;gt;&amp;gt; 8) &amp;amp; 0xFFL);

&lt;span class="rem"&gt;// Now we know what the Red and Green attributes for our desired color are, we can use a Color object to create them&lt;/span&gt;
Color heatColor = Color.FromArgb(255, redByte, greenByte, 0);
&lt;span class="rem"&gt;// And then turn that into a brush&lt;/span&gt;
Brush heatBrush = &lt;span class="kwrd"&gt;new&lt;/span&gt; SolidColorBrush(heatColor);
&lt;span class="rem"&gt;// And then fill the rectangle with this brush&lt;/span&gt;
heatView.Fill = heatBrush;&lt;/pre&gt;


&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;And that’s everything you need to build this app. Below are a couple of screen shots of it in action today (February 11, 2013). Let’s see if it’s advice turns out to be correct! :)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/0552.image_5F00_364C635A.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/4784.image_5F00_thumb_5F00_1631569D.png" width="137" height="244" /&gt;&lt;/a&gt; &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/3288.image_5F00_5D1A799A.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/6431.image_5F00_thumb_5F00_51F0EF50.png" width="137" height="244" /&gt;&lt;/a&gt; &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/6835.image_5F00_03E88FDB.png"&gt;&lt;img title="image" style="border: 0px currentcolor; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-57-88-metablogapi/0167.image_5F00_thumb_5F00_35E03065.png" width="137" height="244" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;MSFT = Bright Green = Strong Buy&lt;/p&gt;

&lt;p&gt;IBM = Brightish Red = Avoid/Sell&lt;/p&gt;

&lt;p&gt;Goog= Dark Green = Buy, but not strong buy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is for educational use only. Do not buy or sell stock based on this app.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can download the source code &lt;a href="https://mediasvcp5lc0xlx242lz.blob.core.windows.net/blogstuff/StockHeatMap.zip" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10392763" width="1" height="1"&gt;</description></item></channel></rss>