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