9
votes

I'm getting error when I added

IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;

in my MainPage.xaml.cs for button click event.

Errors :

  1. The type or namespace name 'IsolatedStorageSettings' could not be found (are you missing a using directive or an assembly reference?)

  2. The name 'IsolatedStorageSettings' does not exist in the current context

I'm using visual studio ultimate 2013 (update 2).

Please help me

1

1 Answers

15
votes

Use the classes in Windows.Storage namespace. They are new for Universal Apps (Windows Phone 8.1 & Windows 8.1).

If you want the data to stay always local try Windows.Storage.ApplicationData.Current.LocalSettings.

However, if you wouldn't mind them been stored in roaming settings (they would be available for your app in Windows 8.1 in case you do Universal Apps) you can use Windows.Storage.ApplicationData.Current.RoamingSettings.

For example,

var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
if(localSettings.Values.ContainsKey("LocationConsent"))

or

var roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
if(roamingSettings.Values.ContainsKey("LocationConsent"))