Application State

,

There are two types of application state: persistent and transient. Persistent state exists when an application launches. It is saved to a private storage area called isolated storage and may include data such as configurable settings or files.

Transient state is discarded when an application is closed. It is stored at the application level in the Microsoft.Phone.Shell.PhoneApplicationService.State dictionary or at the page level in the PhoneApplicationPage.State dictionary.

There is a single PhoneApplicationService instance for the entire app, and its state dictionary should be used only by objects running in the context of the application as a whole. A unique state dictionary is created for each page in your app, and you should use it rather than the PhoneApplicationService.State dictionary whenever possible.


Note

The PhoneApplicationPage.State dictionary is accessible only during or after the OnNavigatedTo method is called, or during or before the OnNavigatedFrom method is called. If you attempt to access it too early or too late an exception is raised.

The PhoneApplicationPage.State dictionary is limited to 2MB for each page and 4MB for the entire app. You should, therefore, not use it for storing a large amount of data.


Transient state may include results from web service calls or data from partially completed forms (see Figure 3.1).

Image

FIGURE 3.1 Persistent state and transient state storage locations.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.51.5