Server/Settings.cs
author StephaneLenclud
Thu, 25 Aug 2016 13:12:54 +0200
changeset 254 181323a59047
parent 235 ba14a29944c4
permissions -rw-r--r--
Published v1.0.1.0.
Updating Harmony library to v0.5.0
     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 using System.Diagnostics;
    22 
    23 namespace SharpDisplayManager.Properties {
    24     
    25     
    26     // This class allows you to handle specific events on the settings class:
    27     //  The SettingChanging event is raised before a setting's value is changed.
    28     //  The PropertyChanged event is raised after a setting's value is changed.
    29     //  The SettingsLoaded event is raised after the setting values are loaded.
    30     //  The SettingsSaving event is raised before the setting values are saved.
    31     internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
    32         
    33         public Settings() : base("default") {
    34             // // To add event handlers for saving and changing settings, uncomment the lines below:
    35             //
    36              this.SettingChanging += this.SettingChangingEventHandler;
    37             //
    38              this.SettingsSaving += this.SettingsSavingEventHandler;
    39             //
    40             this.SettingsLoaded += this.SettingsLoadedEventHandler;
    41             //
    42             this.PropertyChanged += this.PropertyChangedEventHandler;
    43         }
    44 
    45         private void PropertyChangedEventHandler(object sender, System.ComponentModel.PropertyChangedEventArgs e)
    46         {
    47             Trace.WriteLine($"Settings: property changed {e.PropertyName}");
    48             Default.Save();
    49         }
    50 
    51         private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
    52             // Add code to handle the SettingChangingEvent event here.
    53             Trace.WriteLine($"Settings: changing {e.SettingKey}.{e.SettingName}");
    54         }
    55 
    56         private void SettingsLoadedEventHandler(object sender, System.Configuration.SettingsLoadedEventArgs e)
    57         {
    58             Trace.WriteLine($"Settings: loaded {e.Provider.ApplicationName}");
    59         }
    60 
    61         private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
    62             // Add code to handle the SettingsSaving event here.
    63             Trace.WriteLine("Settings: saving");
    64         }
    65     }
    66 }