Channels ▼


Writing Your First Windows 8 App: The Lay of the Land

There are some additional changes for certain features that are worth reviewing. If you feel in the need to launch a background processing operation and the async/await keywords aren't enough, Task.Run is the method you should call to do that. However, whenever possible, try to use the new asynchronous pattern. Forget about both lower level threads and the BackgroundWorker component, you'll always be working with tasks. You will be able to use most of the synchronization primitives you already know from .NET Framework and the lightweight synchronization primitives that Microsoft added in .NET Framework 4.0.

The main XML parser in .NET for Windows Store apps is XML Linq. Thus, you should only use either XmlReader or XmlWriter whenever you require a low-level abstraction and XML Linq isn't enough.

Developing a New Windows Store App Based with Predefined Navigation

In Visual Studio 2012, follow these steps to create a new Windows Store app based on the Grid App template:

  • Select File | New | Project… The New Project dialog box will appear.
  • Select Templates | Visual C# | Windows Store in the left pane. The templates list will display six templates for the selected target (see Figure 6).

Figure 6: The New Project dialog box displaying the details about the Grid App (XAML) template for Windows Store apps.

  • Select Grid App (XAML). The template generates a three-page project for a Windows Store app with navigation features. The app allows the user to navigate among grouped items arranged in a grid and there are dedicated pages to display group and item details. In this case, I want to explain how to consume Web services in a Windows Store app, and therefore, this template provides me with a complete predefined navigation mechanism that I can easily customize. It is useful to learn the user experience Microsoft promotes. However, once you get used to it, you will find it most convenient to start working with the Blank App (XAML) template.
  • Enter the desired name in the Name textbox. I'll use DrDobbsApp because my sample app will consume a Web service and will organize and display some content from Dr. Dobb's. The interaction of apps with services is very important, and therefore, I want to dive deep on the new System.Net.HttpClient with this sample app.
  • Finally, click OK and the IDE will create a new solution with a Windows Store Grid app.

If this is the first time you're creating a project that targets Windows Store, the IDE will display a dialog box requesting your authorization to install a developer license for Windows 8 (see Figure 7). The developer license allows you to install, develop, test, and evaluate Windows Store apps before submitting them for testing and certification to the Windows Store. Once you have a developer license installed, you can run Windows Store apps that haven't been tested and certified by the Windows Store, so you must be careful when running apps from non-trusted sources.

Figure 7: The dialog box that the IDE displays when you try to create a project that targets Windows Store.

The license is free and you only need a Microsoft account. Make sure you read the privacy statement, click I agree, and login with your Microsoft account. Once you have the license, a dialog box will provide information about the expiration date for the license (see Figure 8). You will need to renew the license before it expires.

Figure 8: A dialog box provides information about the developer license expiration date.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.