简体   繁体   中英

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

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"))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM