Monday, 26 March 2012

Isolated Storage

Here’s a nice solution for dealing with WPF isolated storage.

It’s really simple to use, via a nice SaveSettings / ReadSetting interface.

You just need to create a class that holds all your settings as public properties and pass the object into the settings service.


Saving to isolated storage

var settings = new ApplicationSettings
ShowTipsOnStartup = true,
ShowSplashScreen = false,
ItemsPerPage = 25

ISettingsProvider service = new SettingsProvider();

Reading from isolated storage

ISettingsProvider service = new SettingsProvider();
var settings = service.GetSettings<ApplicationSettings>();

Source code:

No comments:

Post a Comment