private void UpdateSettings(NotificationMessage<Settings> newSettings) { userSettings = newSettings.Content; UpdateConsole("Settings updated"); ResetTimer(); }
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(); } } }
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(); } } }