Usman ur Rehman Ahmed's blog

Your First Windows Phone 7 Application Solution Explorer Overview

Ok, so you picked File > New Project under Visual Studio menu and from the New Project dialog box you chose to create Windows Phone Application type project. Once Visual Studio prepares the stage for you (considering this is your first interaction with Windows Phone 7 application) you see a lot of items you are unfamiliar with,

Your-first-windows-phone-application

In this post I will walk you through briefly with each item that make up a standard windows phone application.

Images

A basic application requires following three image resources,

ApplicationIcon.png : This icon is per application and is displayed in Windows Phone applications list (quick launch screen). Under the phone applications list, a recommended icon size of 62 x 62 fits well with other applications.

Application-icon
You are allowed to use any other name for this icon file and to change that look for following line under WMAppManifest.xml file,

<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>

 Background.png : Windows Phone allows you to pin your favorite applications for future easy access. Once you pin an application, a large icon for that application is displayed on the start screen (as shown below). Backround.png refers to this pinned application image displayed on the start screen. Even if the provided image resolution is greater than 173 x 173 (standard size), the Phone 7 OS will adjust the resolution and show a 173 x 173 resolution image. The image format must be a PNG.

Windows_phone_7_start_screen-backround-image
Just like ApplicationIcon file, the reference to this file is found under WMAppManifest.xml file as following,

<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>

<Count>0</Count>

<Title>Test Application</Title>

 

The count is an integer value and is useful to be manipulated during execution if the application nature allows multiple instances be pinned at a time. The count specified appears on the top right of the image as shown in pinned image below,

Title as the name suggests is shown as the title of the application for a pinned application.

Pinned-application
SplashScreeenImage.jpg : Just as the name suggests, this screen is loaded every time you launch an application to act a preloader.

How to Pin an application?

Click and hold the mouse on application icon unless the slider pops up,

Pin
How to Un-Pin an application?

Click and hold the mouse unless the application icon pops out with un-pin icon with mouse,

Un-pin
Properties

                Contained within the Properties folder you will find,

AppManifest.xml : This file is a must part for a “XAP” package submission under Windows phone market place and contains reference to the assemblies used in the application. Note that these references are not be listed in the file unless the XAP package is built thus if you open this file under Visual Studio you will find empty <Deployment.Parts> tag.
Once you build the project the references are automatically listed in the output file. To take a deeper look at how references are injected in this file, build your application and take a look at the contents of this file found under \Bin\Debug or \Bin\Release folders.

AssemblyInfo.cs : Just like a standard windows project, the assembly information file contains information about project title, description, company, trademark, copyright, etc which upon successful build is made part of the output DLL. This file can either be edited directly or from Assembly Information dialog box triggered from project properties console,

Assembly-information

WMAppManifest.xml : Just like AppManifest.xml this is also another integral file for package submission in windows phone market place. However where AppManifest.xml file references assemblies for the application execution only, this file is responsible for configuring your application on a windows mobile by specifying following,

-          Application Title, Version, Author, Publisher and Target platform information

-          Application icons for quick launch and  start screen

-          Windows Phone hardware capabilities available to this application like communication with network, web browsing, microphone and others. Based on the capabilities defined here, the application is granted access to utilize those features.

App.xaml : This file is the design time for the application itself. In the design time declaration you specify the application object referenced by </Application> tag within which you can specify the resources and life time of the application.

Resources impact styling of your application like colors, brushes and visual control (I will write more about this in a later post).  

Life time is controlled by defining events fired by the application. A number of events are available and all are already declared within the XAML <Application.ApplicationLifetimeObjects> tag for developers ease.

                App.xaml.cs : Application scope events declared in App.xaml file are already captured/wired in this file for you. The implementation of most events however is left blank. If you want to perform an action encompassing the entire application this is where you will write code such as application launch or application deactivation. This is also where you need to handle navigational issues or taking measures against unhandled exceptions.

MainPage.xaml : People having knowledge of ASP .net find this concept simpler to understand. This file provides xaml markup to control user interface of the main phone application page. It is composed of number of UI controls nested and defined as a tag each having its relative properties specified.

                MainPage.xaml.cs : This is the code behind file for the main phone application page. Any events exposed by the controls are captured here.

11
To Posterous, Love Metalab