16-01-2013, 10:11 AM
Windows Phone 7 Recipes
1Windows Phone.pdf (Size: 5.58 MB / Downloads: 107)
Problem
You have just bought your new Windows Phone 7 device and would like to start developing applications.
You need to know the device’s hardware characteristics such as screen resolution and memory
capability—but also which sensors and services it provides. Finally, you need to understand what the
Windows Phone 7 operating system provides in order to integrate your application in the best way.
Solution
If you have Windows Mobile development experience, please erase it! Joking aside, Microsoft has
provided a brand new operating system for its new smartphone: Windows Phone 7. This operating system has been written from scratch in order to reach—and sometime go beyond—other operating
systems’ functionalities.
To make an operating system that is reliable and fast and has high performance, Microsoft has
dictated hardware requirements. So, every Windows Phone 7–compatible phone on the market right
now and in the future has (or will have) at least minimum common hardware characteristics. For us as
developers, this is great news, because we can write code having some certainty of what the smartphone
provides.
The Windows Phone 7 device provides a screen resolution of 480×800 pixels in portrait orientation.
In the future, mobile vendors plan to release smartphones with smaller screens having a resolution of
320×480 pixels. Having this in mind, you can create a game and draw your sprites knowing that your
game will be played on a screen with that resolution—so no scale operations, screen text adaptation, and
so forth will be necessary. But even for classic applications showing, for example, text boxes and buttons,
this resolution is useful for drawing rich user interfaces.
Every phone provides three hardware buttons, usually at the bottom of the screen, as shown in
Figure 1-1. They are the Back button, the Start button, and the Search button. The leftmost button is
used to go back to the previous application (just like the Back button on an Internet browser). The
middle button is used to close the current application and to show the Start menu so that the user can
open another application. The rightmost button is used to access the start screen and start a search (for
example, a search into the phone content for contacts or a search on the Bing site).
Understanding the Development Tools
Problem
You want to start developing for Windows Phone 7. You want to know which tools and which languages
you have to use to make an application.
Solution
You have to download the Microsoft Windows Phone Developer Tools.
How It Works
We started Recipe 1-1 saying that if you have Windows Mobile development experience, it is better to
erase it! This is a joke, of course, but it is not completely false. In Windows Phone 7 development, you
don’t have the freedom to create low-level applications with C or C++ languages. Using .NET is the only
way allowed by Microsoft to develop your applications for Windows Phone 7. Even if you find a way to
go around this limitation—let’s say by injecting some Intermediate Language (IL) code at runtime—you
still have to remember that every application will be distributed by Windows Phone Marketplace. And, of
course, before users can find your application on Marketplace, that application has to go through
different approval steps, and you can be sure that any non-.NET application would not pass the
certification process.