Persistent Storage in Windows Phone 7

Posted by Richard Jones on Geeks with Blogs See other posts from Geeks with Blogs or by Richard Jones
Published on Fri, 07 May 2010 13:54:43 GMT Indexed on 2010/05/11 2:55 UTC
Read the original article Hit count: 692

Filed under:

Mark Arteaga – fellow MVP just helped me with this,  thought I’d share.

image

Windows Phone 7 SilverLight supports persistent storage, which is a great way of saving settings betweens runs of your application.

However I couldn’t get it to work.

If you do this to create a persistant storage instance -

   private IsolatedStorageSettings userSettings =
IsolatedStorageSettings.ApplicationSettings;

To retrieve settings do the following -

string xx = userSettings[“SomeValue”].ToString();

 

Hiowever the bit that got me was how to save settings, you have todo this -

userSettings.Add("Hello", DateTime.Now.ToShortTimeString());
          userSettings.Save(); // <- This is the bit that got me

 

Hope this helps others

© Geeks with Blogs or respective owner