When the Windows Phone 7 operating system deactivates an application, it’s the application’s responsibility to persist enough state information to be able to restore the state of the application if and when it’s reactivated by the operating system. This chapter describes how the Tailspin mobile client uses the services offered by the phone to support this behavior.
The mobile client application can also send and receive data from the Tailspin cloud service, and this chapter describes how the application synchronizes data between the phone and the cloud. The focus of this chapter is the way that the mobile client application can use services on the phone to help it run the synchronization tasks asynchronously and in parallel.
the Model-View- ViewModel (MVVM) pattern adopted by the developers at Tailspin. This chapter relates to the model elements of this pattern that represent the domain entities used in the application. Figure 1 shows the key model classes and the relationships between them.
Using Isolated Storage on the Phone
The Windows Phone 7 Surveys application must be able to operate when there is no available network connection. Therefore, it must be able to store survey definitions and survey answers locally on the device, together with any other data or settings that the application requires to operate.
The application must behave as a “good citizen” on the device. It is not possible to access another application’s isolated storage or access the file system directly on the Windows Phone 7 platform, so the application cannot compromise another application by reading or modifying its data. However, there is a limited amount of storage available on the phone, so Tailspin tries to minimize the amount of data that the mobile client application stores locally and be proactive
about removing unused data.
The Tailspin mobile client application must adopt a robust storage solution and minimize the risk of losing any stored data.