繁体   English   中英

我无法使用Windows Phone 8.1的IsolatedStorageSettings

[英]I can't use IsolatedStorageSettings for windows phone 8.1

添加时出现错误

IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;

在我的MainPage.xaml.cs中单击按钮事件。

错误:

  1. 找不到类型或名称空间名称“ IsolatedStorageSettings”(您是否缺少using指令或程序集引用?)

  2. 名称“ IsolatedStorageSettings”在当前上下文中不存在

我正在使用Visual Studio Ultimate 2013(更新2)。

请帮我

使用Windows.Storage命名空间中的类。 它们是Universal Apps的新功能(Windows Phone 8.1和Windows 8.1)。

如果您希望数据始终保持本地状态,请尝试Windows.Storage.ApplicationData.Current.LocalSettings

但是,如果您不介意它们存储在漫游设置中(如果您使用Universal Apps,它们将在Windows 8.1中可用),您可以使用Windows.Storage.ApplicationData.Current.RoamingSettings

例如,

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

要么

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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