locked
Isolated Storage RRS feed

  • Question

  • I was just wondering how you deal with IsolatedStorageSettings in Windows Phone 8.1 SDK. For Example:
    IsolatedStorageSettings.ApplicationSettings.Contains("LocationConsent")

    How does this work in 8.1? As in, how do I write this statement without getting context errors. I feel like it's been deprecated or something because it does not resolve to a known namespace or anything.

    I am working with maps for my current project and porting it to 8.1 gives me some syntax trouble. I have tried looking it up but I think it's too soon for documentation I guess because MSDN doesn't even say anything about it, unless I missed it by accident. Any help is appreciated.


    Friday, November 21, 2014 12:01 PM

Answers

  • Use the classes in Windows.Storage namespace. They are new for Universal Apps. 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.

    var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
    if(localSettings.Values.ContainsKey("Location"))
       DoSomething(localSettings.Values["Location"])

    or

    var roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
    if(roamingSettings.Values.ContainsKey("Location"))
       DoSomething(roamingSettings.Values["Location"])

    This should resolve your issue. I wrote this from the top of my head, hopefully it will work for you.

    • Marked as answer by Shanice Wong Saturday, November 22, 2014 5:24 AM
    Saturday, November 22, 2014 5:14 AM