wp7学习之独立存储之IoslatedStorageSetting
- public partial class MainPage : PhoneApplicationPage
- {
- IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
- // Constructor
- public MainPage()
- {
- InitializeComponent();
- InitializeSettings();
- }
- private void InitializeSettings()
- {
- if (settings.Contains("emailFlag"))
- {
- EmailFlag.IsChecked = (bool)settings["emailFlag"];
- }
- else settings.Add("emailFlag", false);
- }
- private void EmailFlag_Unchecked(object sender, RoutedEventArgs e)
- {
- settings["emailFlag"] = false;
- }
- private void EmailFlag_Checked(object sender, RoutedEventArgs e)
- {
- settings["emailFlag"] = true;
- }
- }