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