Chapter 2. Isolated Storage

In this chapter, we will cover:

  • Saving user settings
  • Opening a file
  • Creating a file
  • Saving username and password
  • Saving an image

Introduction

In Windows Phone 7 environment, local storage is the space available for each application. We can read and write data in this area, but we do not have access to other applications' storage areas or direct access file systems. Isolated storage is the virtual file system available within the application.

There are two main classes used; one is IsolatedStorageSettings class and other is IsolatedStorageFile class. Both classes are part of the namespace

IsolatedStorageSettings uses the dictionary mechanism to store data, hence it uses a key and a value pair for storing any value. Some of the most commonly used methods are Add, Remove, and Contains.

The IsolatedStorageFile class uses isolated storage with files and directories. Therefore, you can save any file stream to the local storage using IsolatedStorageFileStream. Some of the common methods used for managing the files are FileExists, CreateFile, OpenFile, and DeleteFile. Similarly, DirectoryExists, CreateDirectory, and DeleteDirectory are methods used for managing folders.

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

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