应用程序设置Windows Phone 8

时间:2015-03-28 20:59:05

标签: c# visual-studio windows-phone-8

我正在为WP8开发,我需要存储自定义应用设置。我找到了func'ApplicationData',但WP8不支持它。你能帮助我吗?我想存储用户提供的永久变量。例如:

Country = UA
News = 1

1 个答案:

答案 0 :(得分:1)

您可以使用Isolated Storage或ApplicationData.LocalSettings,如下所示:

var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

// Create a simple setting

localSettings.Values["exampleSetting"] = "Hello Windows";

// Read data from a simple setting

Object value = localSettings.Values["exampleSetting"];

if (value == null)
{
    // No data
}
else
{
   // Access data in value
}

   // Delete a simple setting

localSettings.Values.Remove("exampleSetting");

检查此Link以及此Link