Saturday, August 25, 2012

MSDN Magazine

One of my favorite magazine for .NET programmers is Microsoft’s MSDN Magazine, and over the years I have accumulated quite a library of them. What some people might not know is that the magazine is available online at The most recent three issues are available in HTML format. Issues older then three months are available in HTML and most are also available for download in PDF or CHM format. Note that if you want to view the CHM files in Windows 8 you will need to right click on the file, select properties, the click the Unblock button otherwise you will not see the content when you open the file.

The magazine archive on the MSDN site actually goes all the way back to January of 2001. A lot of the information in these older issues is obsolete, but they are still worth taking a look at. While going through  the older issues I have found some very in depth articles on programming and .NET specific topics that are still relevant today. Here are a few you might want to take a look at:

Tame Your Software Dependencies for More Flexible Apps by James Kovacs

Digging into IDisposable by Shawn Farkas

An Introduction to Delegates by Jeffrey Richter

Thursday, August 23, 2012

WinRT App Tile Notification Update

Back when the developer preview of Windows  8 came out I did some blog posts on how to use the tile notification capability in new style WinRT apps. I have been going back over these posts to see what, if anything, has changed between then and the RTM release of Windows 8.
Metro App Tile Notification
The code in the original post works pretty much the same in the RTM version but I did run into one odd problem. In my original post I used the following line of code to get the XML node from the tile template:

 var textNode = xmlTemplate.SelectSingleNode("/title/visual/binding/text[@id='1']");

In the RTM this doesn’t work, the node is not be found. It turns out that this is the expected behavior since the SelectSingleNode method required the XML to have a namespace, otherwise it won’t find the node. I am not sure why this worked in the developer preview. There are ways to get around the missing namespace, but there is an easier solution:
 var textNode = xmlTemplate.GetElementsByTagName("text")[0];

This line achieves the same thing and doesn’t have the namespace issue. Other then this change everything in the original post works fine.

Sunday, August 19, 2012

Windows 8 “Metro” Apps Update

When the Windows 8 developer preview came out I wrote some articles talking about how to develop the new “Metro” style apps. Now that Windows 8 has gone RTM (if you have an MSDN subscription you can download Windows 8 and Visual Studio 2012 right now) I thought I would update the information in those articles.

The first article was called Windows 8 Metro Apps.

The first big change between then and now actually came fairly recently. Due to a legal dispute Microsoft will no longer use the term “Metro” for apps developed for the new user interface in Windows 8. As to what they will now be called, there still seems to be some confusion over this. I have seen the terms “Windows 8 style” and “Modern UI” apps used but they don’t seem to have settled on a final name. To make things more confusing Visual Studio uses the term “Windows Store app”, and as of this writing you will still see the term Metro used in some of the documentation. This naming confusion should eventually settle out. Personally I am going to use the term WinRT app for now since these new style apps run in the new Windows Runtime environment.

Starting a New App

When you create a new project in Visual Studio 2012 the WinRT app templates can be found under each language in the Windows Store group. Also in the new project windows be sure to check out the item called Online. This will give you access to a large number of template and sample applications in various languages.

Developer License

When you try to create your first WinRT app you will be asked to apply for a Developer License. This is a free license and you will need it whether you plan to publish you app to the app store or not.  This license will be tied to your Microsoft account, so you will need one of those if you don’t already have one.

Other then this only other difference you will see when you run the app is the default icon has changed since the developer preview. It now looks like this: