예제 #1
0
 private void UpdateSettings(NotificationMessage<Settings> newSettings)
 {
     userSettings = newSettings.Content;
     UpdateConsole("Settings updated");
     ResetTimer();
 }
예제 #2
0
 private void ReadFromXml()
 {
     var serializer = new XmlSerializer(typeof(Settings));
     using (var reader = XmlReader.Create(Constants.SettingsPath))
     {
         try {
             mySettings = (Settings)serializer.Deserialize(reader);
         }
         catch (InvalidOperationException)
         {
             reader.Close();
             setDefaultSettings();
             SaveToXml();
         }
     }
 }
예제 #3
0
 private void ReadSettings()
 {
     var serializer = new XmlSerializer(typeof(Settings));
     using (var reader = XmlReader.Create(Constants.SettingsPath))
     {
         try
         {
             userSettings = (Settings)serializer.Deserialize(reader);
         }
         catch (InvalidOperationException e)
         {
             reader.Close();
             UpdateConsole("Could not read settings:");
             UpdateConsole(e.ToString());
             UpdateConsole("Using default settings instead.");
             SetDefaultSettings();
         }
     }
 }