X
Business

Windows Phone 7 developer tools: a first look

Microsoft has given developers a look at its programming tools for the upcoming Windows Phone 7 OS. Here are our first impressions.
Written by Peter Ibbotson, Contributor

Microsoft is aiming to attract developers back to mobile Windows with the latest production release of tools for Windows Phone 7. This takes a radically different approach from previous generations of Windows Mobile: in place of the 'classic' Windows Mobile interface is a new design language called Metro. Sadly, after installing the Windows Phone 7 development environment and firing up the emulator, there's little evidence of this new interface:

wp7dev1.jpg

The basic emulator in the Windows Phone 7 development environment

As you can see, you get a very cut-down interface comprising just Internet Explorer and a settings screen. Oddly, many of the final programs are present but turned off within the supplied ROM image. Fortunately, the folks over at xda-developers have produced a ROM with these programs turned back on. This makes the whole phone experience much closer to that a final user will experience (it's worth warning that this isn't a supported mode and https connections are broken).

wp7dev2.jpg

A modification by xda-developers.com to the supplied ROM image unlocks a number of the final programs

In the screenshots above you can see some of Metro's stylistic features where both text and images are generally just truncated. If you look at the 'Office' title bar you'll notice that, as the screen is dragged across from OneNote to Documents, the top title bar is shifted across in a parallax-like effect. For third-party developers, certainly while phones aren't yet available, we'd recommend obtaining this ROM and trying it out in order to generate some design ideas.

The emulator itself is running in an x86 virtual machine and won't run at the same time as other virtualisation solutions (although it does work with Fusions on the Mac). It does feel slightly snappier when video acceleration hardware is present. Most of the initial Windows Phone 7 devices will have an 800-by-480-pixel screen, but developers should be aware that at some point a 480-by-320-resolution phone with a keyboard below the screen will be available — probably looking something like a Blackberry.

Microsoft is being generous to would-be developers, as the tools you need are free — you can download them from Microsoft's developer site. However, to actually publish software to a phone you'll need to register with the Marketplace. This costs £67 (ex. VAT) and lets you submit unlimited paid applications via the certification process (and up to five free applications) — a process that's supposed to take 14 business days. Once you've got a developer account you can unlock up to four phones in order to download your software to different phones for testing (note that this is a software not an operator unlock). If you're a student, you should be able to get a free account.

Microsoft will take 30 percent of revenue and will deal with billing via a mobile operator. EU-based developers should beware that this will all be handled out of the US, so you'll need to tell the US tax authorities that you're based in Europe (you'll also need to exceed $200 in terms of sales). The one unfriendly part of the agreements you need to sign is that there's an explicit ban on GPLv3-licensed software. Reading between the lines, several other open-source licences that require source code distribution won't be valid. Some feel that this is, in part, designed to prevent Microsoft being found to be a distributor and forcing it to licence patents or provide source code for applications hosted in the Marketplace. Apple has pulled GNU Go from the app store, so Microsoft isn't alone here.

If you want to write games, you'll be wanting to use XNA, which theoretically means you can use the same codebase across the Xbox, Windows and Windows Phone 7. To get involved with this, start up Visual Studio 2010 and start writing C# code; one thing that might recapture those used to regular Windows programming is the way that each on-screen element is drawn from inside a game loop.

wp7dev3.jpg

XNA programming in C#, in Visual Studio 2010

Among the 2D sample games that Microsoft provides is a catapult game:

wp7dev4.jpg

A sample 2D catapault game from Microsoft

If you want something a little more exciting, there's a 3D sample game that uses the accelerometer to control a marble around a maze with holes in it:

wp7dev5.jpg

This sample 3D game makes use of the phone's accelerometer

There are several other samples around, most of which are available at the XNA Creators Club. For example, out of the box there's no built-in joystick, but touch thumb-sticks are available for download. Several other samples, including particles for explosions, are available from the same source.

Microsoft is initially aiming Windows Phone 7 devices at consumers, so this looks like a good platform for gaming companies. However, the games are supposed to have an under-12 rating, so there are limits to type of content allowed.

XNA programming must be done in C#, but for the more business-related Silverlight, you can use either C# or Visual Basic (currently in beta). Today most Silverlight programming is done using a Model View View-Model (MVVM) architecture, which is loosely based on the older MVC pattern. This is often used to provide a split between a designers and programmers, with the main bulk of the code separated out. To help with this, Microsoft offers Expression Blend.

Working within Blend, you can create an application pretty quickly. We've started here by grabbing an RSS data feed and importing it as a data source while we work on an imaginary copy of the ZDNet iPhone application. On the right-hand side you can see that each item in our RSS feed has been converted into a StackPanel with a list of text block elements underneath. Although this provides a good starting point, it's not a great look. With a bit of work we can change this.

wp7dev6.jpg

Styling the import RSS data feed items in Microsoft's Expression Blend.

Each item on the list has an ItemTemplate that we can redesign to restructure our items. We first change the order and size of elements from the automatically generated structure, dragging and dropping our item list from the data source pane on the right.

We've shown with arrows where each bit of the item template is shown in the list. Obviously a proper designer needs to be involved, but once this initial phase is done, the project can be passed over and the designer can work on the full project while the developer concentrates on getting the back-end software written.

Our final application when it's running in the emulator doesn't look too bad but you can see where a short headline has left the bounding border looking a bit out of line:

wp7dev77.jpg

The final application running in the Windows Phone 7 emulator

Blend provides a great design-time experience, but we think it's unlikely that a designer without any programming experience will make the best of it. It's poosible that Microsoft agrees, because you can import designs from Adobe Illustrator and Photoshop — an option that programmers who work with pixel-perfect designers might want to consider. Microsoft provides a set of PSD templates for designers to work with.

There are still some unanswered issues with Windows Phone 7. For example, there's currently no model for corporate developers wanting to generate and provision private applications. Microsoft recognises this, and is planning something for the future. Right now, though, the company's target is the holiday season launch, which is firmly aimed at consumers. There's also no way to access the underlying Windows CE OS in native mode, an omission that Microsoft has deliberately made in order to maximise battery life.

Another source of potential pain is 'Tombstoning', where applications can be put to sleep and then, when restarted, it reloads its object model from disk. This is similar to the model that Apple used in iOS, and we suspect it may prove tricky to track down bugs as saving and restoring the information is a process that the programmer has to code for.

Microsoft has done a good job with this initial release, but it needs to move fairly rapidly to support corporate developers. Otherwise Windows Phone 7 might end up in a 'gaming phone' ghetto.

Editorial standards