Chapter 28. Preserving App State and Settings

,

In This Chapter

Image Managing files and directories in your app’s data store

Image Reading and writing files

Image Measuring the amount of free space available to your app

Image Approaches for optimizing serialization performance

Image Saving application settings

Image Using attributes to automatically preserve state

Image Binary serialization using Silverlight Serializer

Image Property lambda expressions


Preserving app state is one of the key challenges facing Windows Phone developers.

To capture and restore state that is maintained across application launches, Windows Phone provides a segregated storage area called the local folder. The local folder is a managed storage area where your app can read and write data; it is inaccessible to other apps.


Note

In the Windows Phone 7.1 OS, the local folder was known as isolated storage.


This chapter begins with a conceptual overview of the local folder and looks at managing files and directories within the data store. You see how to read and write files using the .NET Isolated Storage API, and you are introduced to the new Windows Storage API present in Windows Phone 8. You then explore the IsolatedStorageSettings class and see how it is used to automatically persist application settings.

The chapter then examines a custom state preservation system, which uses an attribute-based mechanism for preserving viewmodel property values automatically. You see that by decorating your viewmodel’s properties with an attribute, the property’s value can be preserved using binary serialization, either transiently using an OS managed State dictionary, or persistently in isolated storage.

Finally, you learn how the custom state preservation API is used to preserve fields and to inject logic during state operations.

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

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