Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't use IsolatedStorageSettings for windows phone 8.1

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

like image 430
Ashiq Hassan Avatar asked Jul 05 '14 01:07

Ashiq Hassan


1 Answers

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"))
like image 148
Vyas Avatar answered Oct 31 '22 16:10

Vyas