StephaneLenclud@123: // StephaneLenclud@123: // Copyright (C) 2014-2015 Stéphane Lenclud. StephaneLenclud@123: // StephaneLenclud@123: // This file is part of SharpDisplayManager. StephaneLenclud@123: // StephaneLenclud@123: // SharpDisplayManager is free software: you can redistribute it and/or modify StephaneLenclud@123: // it under the terms of the GNU General Public License as published by StephaneLenclud@123: // the Free Software Foundation, either version 3 of the License, or StephaneLenclud@123: // (at your option) any later version. StephaneLenclud@123: // StephaneLenclud@123: // SharpDisplayManager is distributed in the hope that it will be useful, StephaneLenclud@123: // but WITHOUT ANY WARRANTY; without even the implied warranty of StephaneLenclud@123: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the StephaneLenclud@123: // GNU General Public License for more details. StephaneLenclud@123: // StephaneLenclud@123: // You should have received a copy of the GNU General Public License StephaneLenclud@123: // along with SharpDisplayManager. If not, see . StephaneLenclud@123: // StephaneLenclud@123: StephaneLenclud@235: using System; StephaneLenclud@235: StephaneLenclud@123: namespace SharpDisplayManager.Properties { sl@48: sl@48: sl@48: // This class allows you to handle specific events on the settings class: sl@48: // The SettingChanging event is raised before a setting's value is changed. sl@48: // The PropertyChanged event is raised after a setting's value is changed. sl@48: // The SettingsLoaded event is raised after the setting values are loaded. sl@48: // The SettingsSaving event is raised before the setting values are saved. sl@48: internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { sl@48: sl@48: public Settings() : base("default") { sl@48: // // To add event handlers for saving and changing settings, uncomment the lines below: sl@48: // StephaneLenclud@235: this.SettingChanging += this.SettingChangingEventHandler; sl@48: // StephaneLenclud@235: this.SettingsSaving += this.SettingsSavingEventHandler; sl@48: // StephaneLenclud@235: this.SettingsLoaded += this.SettingsLoadedEventHandler; StephaneLenclud@235: // StephaneLenclud@235: this.PropertyChanged += this.PropertyChangedEventHandler; sl@48: } StephaneLenclud@235: StephaneLenclud@235: private void PropertyChangedEventHandler(object sender, System.ComponentModel.PropertyChangedEventArgs e) StephaneLenclud@235: { StephaneLenclud@235: Console.WriteLine($"Settings: property changed {e.PropertyName}"); StephaneLenclud@235: Default.Save(); StephaneLenclud@235: } StephaneLenclud@235: sl@48: private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { sl@48: // Add code to handle the SettingChangingEvent event here. StephaneLenclud@235: Console.WriteLine($"Settings: changing {e.SettingKey}.{e.SettingName}"); sl@48: } StephaneLenclud@235: StephaneLenclud@235: private void SettingsLoadedEventHandler(object sender, System.Configuration.SettingsLoadedEventArgs e) StephaneLenclud@235: { StephaneLenclud@235: Console.WriteLine($"Settings: loaded {e.Provider.ApplicationName}"); StephaneLenclud@235: } StephaneLenclud@235: sl@48: private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { sl@48: // Add code to handle the SettingsSaving event here. StephaneLenclud@235: Console.WriteLine("Settings: saving"); sl@48: } sl@48: } sl@48: }