问题
There is a MSDN article that explains how to create a settings page for Windows Phone 8. I immediately ran into an error because Windows.IO.IsolatedStore is deprecated or something. It does not exist. And I got used to Windows.Storage.ApplicationData.Current.LocalSettings anyway.
I want to ask if there is an updated article somewhere. If not, my question is: Is this approach still used, or should I consider another way?
At the moment I am simply doing this:
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
if (localSettings.Values.Keys.Contains("my_setting") == false)
{
localSettings.Values["my_setting"] = 1.0;
}
回答1:
The article you link is for Windows Phone Silverlight apps (both 8 and 8.1). For a Windows Store app see Quickstart: Add app settings
There isn't a dedicated SettingsFlyout control for a Windows Phone Store app and so no page explaining how to use it. You'll do essentially the same is you will in Silverlight doc except that you'll save your data with ApplicationData settings (you have that correct, but consider roaming the settings), and you'll use the Windows.UI.Xaml controls instead of the Silverlight controls to build your page.
来源:https://stackoverflow.com/questions/27070221/how-to-create-a-settings-page-for-windows-8-1-apps