author | StephaneLenclud |
Tue, 16 Aug 2016 12:59:32 +0200 | |
changeset 235 | ba14a29944c4 |
parent 123 | 0df386e37e29 |
child 253 | 2dae7a163fff |
permissions | -rw-r--r-- |
StephaneLenclud@123 | 1 |
// |
StephaneLenclud@123 | 2 |
// Copyright (C) 2014-2015 Stéphane Lenclud. |
StephaneLenclud@123 | 3 |
// |
StephaneLenclud@123 | 4 |
// This file is part of SharpDisplayManager. |
StephaneLenclud@123 | 5 |
// |
StephaneLenclud@123 | 6 |
// SharpDisplayManager is free software: you can redistribute it and/or modify |
StephaneLenclud@123 | 7 |
// it under the terms of the GNU General Public License as published by |
StephaneLenclud@123 | 8 |
// the Free Software Foundation, either version 3 of the License, or |
StephaneLenclud@123 | 9 |
// (at your option) any later version. |
StephaneLenclud@123 | 10 |
// |
StephaneLenclud@123 | 11 |
// SharpDisplayManager is distributed in the hope that it will be useful, |
StephaneLenclud@123 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
StephaneLenclud@123 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
StephaneLenclud@123 | 14 |
// GNU General Public License for more details. |
StephaneLenclud@123 | 15 |
// |
StephaneLenclud@123 | 16 |
// You should have received a copy of the GNU General Public License |
StephaneLenclud@123 | 17 |
// along with SharpDisplayManager. If not, see <http://www.gnu.org/licenses/>. |
StephaneLenclud@123 | 18 |
// |
StephaneLenclud@123 | 19 |
|
StephaneLenclud@235 | 20 |
using System; |
StephaneLenclud@235 | 21 |
|
StephaneLenclud@123 | 22 |
namespace SharpDisplayManager.Properties { |
sl@48 | 23 |
|
sl@48 | 24 |
|
sl@48 | 25 |
// This class allows you to handle specific events on the settings class: |
sl@48 | 26 |
// The SettingChanging event is raised before a setting's value is changed. |
sl@48 | 27 |
// The PropertyChanged event is raised after a setting's value is changed. |
sl@48 | 28 |
// The SettingsLoaded event is raised after the setting values are loaded. |
sl@48 | 29 |
// The SettingsSaving event is raised before the setting values are saved. |
sl@48 | 30 |
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { |
sl@48 | 31 |
|
sl@48 | 32 |
public Settings() : base("default") { |
sl@48 | 33 |
// // To add event handlers for saving and changing settings, uncomment the lines below: |
sl@48 | 34 |
// |
StephaneLenclud@235 | 35 |
this.SettingChanging += this.SettingChangingEventHandler; |
sl@48 | 36 |
// |
StephaneLenclud@235 | 37 |
this.SettingsSaving += this.SettingsSavingEventHandler; |
sl@48 | 38 |
// |
StephaneLenclud@235 | 39 |
this.SettingsLoaded += this.SettingsLoadedEventHandler; |
StephaneLenclud@235 | 40 |
// |
StephaneLenclud@235 | 41 |
this.PropertyChanged += this.PropertyChangedEventHandler; |
sl@48 | 42 |
} |
StephaneLenclud@235 | 43 |
|
StephaneLenclud@235 | 44 |
private void PropertyChangedEventHandler(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
StephaneLenclud@235 | 45 |
{ |
StephaneLenclud@235 | 46 |
Console.WriteLine($"Settings: property changed {e.PropertyName}"); |
StephaneLenclud@235 | 47 |
Default.Save(); |
StephaneLenclud@235 | 48 |
} |
StephaneLenclud@235 | 49 |
|
sl@48 | 50 |
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { |
sl@48 | 51 |
// Add code to handle the SettingChangingEvent event here. |
StephaneLenclud@235 | 52 |
Console.WriteLine($"Settings: changing {e.SettingKey}.{e.SettingName}"); |
sl@48 | 53 |
} |
StephaneLenclud@235 | 54 |
|
StephaneLenclud@235 | 55 |
private void SettingsLoadedEventHandler(object sender, System.Configuration.SettingsLoadedEventArgs e) |
StephaneLenclud@235 | 56 |
{ |
StephaneLenclud@235 | 57 |
Console.WriteLine($"Settings: loaded {e.Provider.ApplicationName}"); |
StephaneLenclud@235 | 58 |
} |
StephaneLenclud@235 | 59 |
|
sl@48 | 60 |
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { |
sl@48 | 61 |
// Add code to handle the SettingsSaving event here. |
StephaneLenclud@235 | 62 |
Console.WriteLine("Settings: saving"); |
sl@48 | 63 |
} |
sl@48 | 64 |
} |
sl@48 | 65 |
} |