Understanding the development environment
To begin developing applications for Windows Phone 7 devices, you will first need to download and install some development tools for the same. You can find the Windows Phone Developer Tools at http://www.microsoft.com/downloads/en/details.aspx
Note: The Windows Phone Developer Tools work only on Windows Vista and Windows 7. They will not work with Windows XP, any of the server environments, inside a VM or HyperV environment.
Tip: If you already have a full version of Visual Studio installed on your machine, you can use that to develop applications for Windows Phone 7 instead of the express-edition that gets installed as part of the Windows Phone Developer Tools. The Windows Phone Developer Tools installation adds templates to create Windows Phone 7 Application projects from your development environment.
Please note that some familiarity with Visual Studio and .Net is expected in this blog series. You do not necessarily need experience with Silverlight however.
Open an instance Visual Studio 2010 on your machine. From the File menu choose New Project and select Silverlight for Windows Phone Template from the list of installed templates on the left hand side. You will see the list of available Windows Phone application templates available on the right hand side as shown in figure 1.
You can also select the XNA Game Studio 4.0 template from the left hand side and see the list of project templates available if you want to develop games for Windows Phone 7 or XBOX 360 as shown in figure 2.
In this series we will focus on developing Silverlight applications for Windows Phone 7.
Once you create a new Windows Phone Application, you should notice the different types of files added to your solution by default. A description of a few of these files is provided below for your reference:
Defines the entry point of the application, initializes application-scoped resources, and displays the application user interface.
Defines a page with the user interface of the application.
An image file with an icon that represents the application icon in the phone’s application list.
An image file with an icon that represents the application icon in the start screen.
This is the image that will first be displayed when the application launches. The splash screen gives the user immediate feedback that the application is launching and will remain displayed until the navigation to the first page has been completed. Your splash screen can look similar to your first page in order to give the appearance that the application is loading quickly.
A manifest file that includes specific metadata related to a Windows Phone Silverlight application, including specific features available only for Silverlight for Windows Phone.
Life Cycle of a Windows Phone Application
This section describes the different states a Windows Phone application goes through.
A Windows Phone applications is "launched" when it is opened any way other than clicking the back button on the device. This way a new instance of an application is opened. This event is raised before the application is visible or active.
After the Launching event of an application is complete, it goes in a Running state. The application remains in this state until it is closed or deactivated.
The Closing event is raised when the application is terminated and the user is unable to come back to the application in a previous state. Once the Closing event is raised, the user can only access a new instance of your application. This state can be achieved when the user clicks the back button to go past the application's first page.
An application goes into the Deactivated state when the user browses away from the application but can return to it in a previous state. This can happen when the user clicks the Start button on the hardware while your application is running or the timeout enables the lock screen on the phone. A deactivated application may become tombstoned.
After an application has been deactivated and tombstoned, it may be activated again if the user navigates back to the application. One case when this might happen is when the user clicks the back button on the hardware until he reaches your application. In this event, an application can read values from the State dictionary in the PhoneApplicationService class to reestablish the state of the application that the user experienced before the application was deactivated.
Tip: Tombstoning is the procedure in which the operating system terminates an application’s process when the user navigates away from the application. The operating system maintains state information about the application. If the user navigates back to the application, the operating system restarts the application process and passes the state data back to the application.
Figure 3 illustrates the complete application life cycle for Windows Phone applications.