Advertisment

Developing Metro Apps for Windows 8

author-image
PCQ Bureau
New Update

Last month, we looked at how Windows 8 introduces a completely new API and feature set to allow you as developers to create a whole new style of apps that can work on different devices such as tablets, desktops and notebooks. WinRT, as it's called, abstracts a number of APIs from you to allow you to start creating apps quickly and easily while still working in a familiar .NET like environment. For Web developers, it also allows you to create full fledged Metro apps using HTML/CSS and JavaScript.

Advertisment

Snapshot

Price: Windows developers

USP: Get started with developing Metro Apps for Win 8

Related articles: Windows 8 Developer Preview: http://ld2.in/3vr


Search engine keywords: Windows 8

In this article we'll take a look at how and what you can do with the tools that you are provided with for doing these tasks. We'll not delve deep into the new WinRT API as this is bound to change over the next few builds of Windows 8. But working with the tools you are given currently will give you a great understanding of how these apps are going to be built and used by consumers at the end.

Creating an App

Advertisment

To create a Windows 8 Metro app, you will need Visual Studio 11 Express for Windows Developer Preview. This is built in to the Windows 8 Dev Preview x64 version available for download from Microsoft. If you have installed this version, you have everything you need to start creating apps.

The first thing you do is to select the language and template that you wish to start developing in. You get a choice of 4 languages --JavaScript, VB, C# or C++ and a bunch of pre-built application templates such as the blank "Application", rich "Grid", master-child "Split" and test and class library projects. The first 3 are specifically Metro apps and can be used to start off a new project. Once a project template is chosen you can go ahead and start writing your code using the (slightly different) Metro-XAML and the code behind in JS/VB/C#/C++.

Advertisment

The Grid and Split templates come with a number of things already setup for you which you can customize. These include a number of things as follows.

Application Icons: Each application has at least a small, 150x150 icon used to represent it on the Start screen. It can optionally also have a large 310x150 icon that can be used as a "Live Tile" -- one that also displays some information about what's happening in the App without even running it. For eg, your app could display the number of mentions or direct messages the user has recieved in Twitter or Facebook on the app tile itself without the user having to run the app himself. The user has the ability to switch the type of icon used on the Start screen for your app.

Advertisment

Splash Screen: A custom splash screen image for when the app is starting up for the first time.

Data: These templates come with some data binding pre-defined for local data. You can of course customize these for any set of data --local or remote.

Advertisment

Apps also have other capabilities such as having an "Application Bar" --a new term for a redesigned menu bar and "Contracts" --an ability to share or consume information from other apps without requiring a need for copy-paste by the user. Your app can also be part of the search capability of the system by providing a search contract. Applications in Metro have access to some unique Metro controls.

One of the really nice touches in VS11 for Windows 8 is the ability to test out your apps in the tons of different environments that your app could potentially run in. Windows 8 is going to be available on tablets with low resolutions to notebook and desktops with extremely high resolutions, orientation differences and with multi-touch capablities. To test out how your app responds to all these different environments, once you have built the app on your machine, you can actually use the Windows 8 "Simulator" to test these out.

The Windows 8 Simulator is built into the VS11 preview. You can choose whether to run your app on the local machine, remote machine or Simulator. If you choose the latter, it will open up an instance of the Simulator and deploy your app within it and run it.

Advertisment

You can debug and test your app with different features within it including changing the screen resolution, orientation (landscape/portrait) and even enabling multi-touch gestures with a mouse if you don't have a multi-touch enabled device with you.

Once you are ready to release your app, VS allows you to package the app and deploy it to the App Store --the part of Windows 8 from where users will find and install your apps. When you do need to do this, you must first get a developer account in the store (not yet available) and then deploy the package there along with certain information such as a description of the app, the price and if there is a trial available.

Overall, creating a Windows 8 app is not at all difficult if you are already used to VS or .NET. For HTML/JavaScript developers there might be a small learning curve, but once that is over, they will find that the tools given in VS make are extremely easy to develop great apps for Windows 8. So boot up your install of Windows 8 and VS11 and start developing.

Advertisment