Condividi tramite


Windows Phone 7 Guidance

Over a year ago the Microsoft patterns & practices (p&p) team released the Windows Phone Developer Guide as part of a series on Windows Azure service and client application development. The guide described a scenario concerning a fictitious company named Tailspin that had decided to embrace Windows Phone as a client device for their existing cloud-based application.

Following the release of Windows Phone 7.5, and the Windows Phone 7.1 SDK, they have now released an updated and improved edition of the guide. The spirit of the guide has not changed, but the title has. The guide is now called "A Case Study for Building Advanced Windows Phone Applications: Connecting with Cloud Services. " They decided to change the title to better reflect the scope and focus of the content. The guide is about building advanced applications. If your application is really simple, you might not need all of the abstractions included in the guide. But if high-quality software is your goal, the guide is definitely for you.

Testability is a major focus of the guide, and they have expanded the testability content into a new piece of guidance called "Building Testable Windows Phone Applications". This guidance is aimed at developers who want to build Windows Phone applications that can be easily tested by unit tests.

One way of increasing the testability of a Windows Phone application is to use the MVVM pattern. However, not all developers are aware of how to build a Windows Phone application that uses the clean separation of concerns provided by the MVVM pattern. Therefore, they also created a third piece of guidance, “Developing a Windows Phone Application using the MVVM Pattern”, which shows how to build a Windows Phone application that uses the MVVM pattern.

What’s in the Guidance?

A Case Study for Building Advanced Windows Phone Applications

This guidance will show you how to design and implement a compelling end-to-end application using the Windows Phone 7.1 SDK. Some of the topics that you will learn about include the following:

  • Displaying user interfacenotifications
  • Using the MVVM pattern
  • Managing state and performing navigation
  • Encrypting and decrypting credentials
  • Persisting data to and from isolated storage
  • Synchronizing data between a Windows Phone device and a cloud service, both in the background andthe foreground
  • Pinning Application Tiles and Secondary Tiles to Start
  • Capturing location data, image data, and audio data
  • Authenticating with a cloud service from a Windows Phone application
  • Pushing notifications to Windows Phone devices
  • Transferring data between a Windows Phone device and a cloud service
  • Abstracting the Windows Phone 7.1 SDK
  • Unit testing MVVM applications

You can choose to read the content in the guide in the order that suits your knowledge and experience, and select the sections that most interest you or are most applicable to your needs. However, the chapters follow a logical sequence that describes the stages of designing and building an application. The tube map below depicts the learning path through the guide.

This guide has an accompanying example application — the Surveys mobile client application for Windows Phone. You can download the application and run it on your own computer to see how it works and to experiment and reuse the code.

The result is that, after reading the guidance, you should know how to build your own advanced, loosely coupled, testable applications using the Windows Phone 7.1 SDK.

Building Testable Windows Phone Applications

This guidance will show you how to build testable Windows Phone applications that:

  • Consume location data
  • Perform navigation
  • Persist data to and from isolated storage
  • Consume sensor data
  • Use a chooser to take aphoto

The guidance includes a series of accompanying sample applications. You can download these sample applications and run them on your own computer to see how they work, and to experiment and reuse the code.

There is one accompanying NuGet package for this guidance. The Microsoft.Practices.Phone.Adapters.Source package contains interfaces, and adapter and facade implementations of the interfaces, which mirror functionality in several classes in the Windows Phone 7.1 SDK.

The result is that, after reading this guidance, you should be able to build your own loosely coupled, testable applications using the Windows Phone 7.1 SDK.

Developing a Windows Phone Application using the MVVM Pattern

This guidance will show you the basics of MVVM and dependency injection through a sample application, PetrolTracker, that enables you to track the petrol consumption of three vehicles. The sample application is authored two different ways so that you can see the progression from a code-behind implementation, to a view model implementation whose dependencies are injected. Some of the topics that you will learn about include the following:

  • Application Launching Events
  • Saving and Restoring Page State
  • The Motivation for MVVM
  • The MVVM Pattern
  • The Benefits of MVVM
  • Connecting View Models to Views
  • Dependency Injection
  • Invoking Commands from a View
  • Invoking Navigation from a View
  • Displaying User Interface Notifications
  • Abstracting the Windows Phone 7.1 SDK
  • Unit Testing MVVM Applications

The result is that, after reading this guidance, you should be able to build Windows Phone applications that use the MVVM pattern, whose dependencies are injected.

How to Get It?

A Case Study for Building Advanced Windows Phone Applications

To read the guidance and download the application, see A case study for Building Advanced Windows Phone Applications on MSDN.

Building Testable Windows Phone Applications

To read the guidance, see Building Testable Windows Phone Applications on MSDN.

The Microsoft.Practices.Phone.Adapters.Source can be downloaded as NuGet package.

Developing a Windows Phone Application using the MVVM Pattern

To read more and download the sample application, see Developing a Windows Phone Application using the MVVM Pattern on MSDN.