问题描述
我只是想知道你是如何应对的Windows Phone 8.1 SDK IsolatedStorageSettings。例如:
IsolatedStorageSettings.ApplicationSettings.Contains(LocationConsent)
如何在8.1这个工作呢?正如,我怎么写这种说法没有得到上文中的错误。我觉得它已经过时或东西,因为它没有解决一个已知的命名空间或任何东西。
我为我的当前项目映射工作,将它移植到8.1给我一些语法麻烦。我试图寻找它,但我认为这是太早文档我猜是因为MSDN甚至不说什么,除非我错过了意外。任何帮助表示赞赏。
使用在Windows.Storage命名空间中的类。他们是新的通用应用程序。如果你希望数据始终保持当地尝试的。但是,如果你不介意他们存储在漫游设置(他们将可为您在Windows 8.1的情况下,应用程序,你做的通用应用程序),可以使用的。
VAR localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
如果(localSettings.Values.ContainsKey(LocationConsent))
DoSomething的(localSettings.Values [LocationConsent])
或
VAR roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
如果(roamingSettings.Values.ContainsKey(LocationConsent))
DoSomething的(roamingSettings.Values [LocationConsent])
这应该解决您的问题。我写这从我的头顶,希望它会为你工作。
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.
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("LocationConsent"))
DoSomething(localSettings.Values["LocationConsent"])
or
var roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
if(roamingSettings.Values.ContainsKey("LocationConsent"))
DoSomething(roamingSettings.Values["LocationConsent"])
This should resolve your issue. I wrote this from the top of my head, hopefully it will work for you.
这篇关于的Windows Phone 8.1 - 独立存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!