Array

Developing Windows Phone 7 Applications

Must Read

Admin
Admin
Just post!

The Windows Phone Developer Tools install a series of templates into Visual Studio 2010, Visual Studio 2010 Express, and Expression Blend that provide a starting point for developing Windows Phone applications.

To use a Windows Phone 7 template in Visual Studio and Visual Studio Express

  1. On the Visual Studio File menu, point to New, and then click Project.
  2. In the Installed Templates tree view, expand Visual C#, and then click Silverlight for Windows Phone.
  3. In the central pane of the New Project dialog box, select the type of application you want to start with. If you want to display a list of items on the start page, select Windows Phone List Application. If you want to begin with a simple empty start page, select Windows Phone Application. If you are adding a new class library project to an existing Windows Phone 7 application, select Windows Phone Class Library. If you want to build an application that contains a Panorama or a Pivot control for displaying information, select Windows Phone Panorama Application or Windows Phone Pivot Application.
  4. Enter a name and specify the location for the new project, and then click OK.

To use a Windows Phone 7 template in Expression Blend for Windows Phone

  1. Do one of the following:
    1. In the startup dialog box, click New Project.
    2. On the File menu, click New Project.
  2. If you want to begin with a simple start page, select Windows Phone Application in the list of installed templates. If you want to display a list of data-bound items on the start page, select Windows Phone Databound Application. If you want to create a new control project, select Windows Phone Control Library. If you want to build an application that contains a Panorama or a Pivot control for displaying information, select Windows Phone Panorama Application or Windows Phone Pivot Application.
  3. Enter a name and specify the location for the new project, and then click OK.

The templates create a complete application with a “start” page that contains a list of sample data items and a “details” page that is displayed when you click an item in the list.

The template applications follow a basic Model-View-ViewModel (MVVM) pattern. The two UI pages are views of the data, although they do contain some code-behind to implement transitions and navigation, and to set the data context of the views. There are two view models, one for each view, that contain the public properties bound to the controls in the views and logic to create the list of items displayed in the views.

You can run the application as it stands to see how it works and to experiment with the emulator. The emulator can be rotated and resized as required. It also contains an implementation of Internet Explorer that you can use to browse the Internet or your own webbased applications.

For information about writing applications for Windows Phone 7, see the following resources:

  • “Windows Phone 7 Jump Start Training” on the App Hub (http://create.msdn.com/en-US/education/catalog/article/wp7_jump_start).
  • “Getting Started with Windows Phone Development” on MSDN (http://msdn.microsoft.com/en-us/library/
    ff402529(VS.92).aspx).
  • “Windows Phone Development” on MSDN (http://msdn.microsoft.com/en-us/library/ff402535(VS.92).aspx).
  • “Application Features for Windows Phone” on MSDN (http://msdn.microsoft.com/en-us/library/ff402551(VS.92).aspx).

Developing Trial Applications for Windows Phone 7

Windows Phone 7 allows you to easily publish trial versions of your application that users can install from Windows Marketplace. This is a useful way to demonstrate your application and allow users to decide if it is suitable for their requirements before they buy the full version. The trial version must reasonably represent the functionality and quality of the full application in order to obtain certification.

In general, you should avoid setting a time limit in trial versions so that users can install the trial more than once and will not find that it is blocked if they decide to evaluate it more fully at a later date. Instead, limit the use of some features so that the user can experience the main functionality and will want to buy the application to unlock these additional features.

Windows Phone 7 implements the IsTrial method of the License Information class (located in the Microsoft.Phone.Marketplace namespace). Your application can call this method to discover whether the user is running a trial version or the full purchased version, and either display appropriate messages or direct the user to the page
where they can purchase the full version. You can display the Windows Marketplace page for the current application by calling the Show method of the MarketplaceDetail class without specifying a content identifier.

Testing Trial Versions in an Emulator or Device

When you test an application using the emulator or an unlocked physical device, the IsTrial method will always return false. Instead, you can emulate trial mode using the Guide class (located in the Microsoft.Xna.Framework.GamerServices namespace). When you set the SimulateTrialMode property to true, the IsTrial method will return true. You should query the IsTrial method as soon as possible and cache the result because the value may change if the application later detects a valid license.

For more information about implementing trial versions of your applications, see “Creating Trial Applications for Windows Phone” on MSDN (http://msdn.microsoft.com/en-us/library/ff967554(VS.92). aspx).

Developing Web Applications for Windows Phone 7

An alternative approach to building applications for Windows Phone 7 is to rely on the built-in Web browser within the operating system of the phone to display web pages, instead of designing and building a phone-based UI and using client-side code. This does not provide the same user experience, but it may be a useful approach when you already have a suitable application that you want to expose to phone users. You can also use a combination of the Web browser and a custom phone application. For example, you may consume services such as the Windows Live® log-on page to allow users to log on to a service and then use this logon in your phone-based application.

For a website to be usable on the small screen of a Windows Phone, you will most likely need to provide a more compact view of the pages than would be delivered to a normal desktop browser. You can use features in ASP.NET to detect the type of browser making the request and adapt the output simply by applying a different style sheet (for example, to remove extraneous content such as navigation bars and related content panels). Alternatively, you may decide to
generate completely different pages with a simplified navigation model when you detect that the client is a small-screen device such as a phone.

These topics are not covered in this guidance, but you can learn more from the video presentation, Designing and Developing for the Rich Mobile Web on the Mix 10 website (http://live.visitmix.com/MIX10/Sessions/CL23) or by downloading the white paper, Designing Web Sites for Phone Browsers, from the Microsoft Download Center (http://go.microsoft.com/?linkid=9713253).

 

- Advertisement -

Latest News

Unpacking Fixed Rate HELOCs: The Good, the Bad, and Everything In Between

Today, we're diving deep into the world of Fixed Rate Home Equity Lines of Credit (HELOCs). If you're a...
- Advertisement -

More Articles Like This

- Advertisement -