GARbro-mirror/GUI/Settings.cs

44 lines
1.8 KiB
C#
Raw Normal View History

2016-01-07 23:06:08 +08:00
namespace GARbro.GUI.Properties {
// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {
public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
this.SettingsLoaded += OnSettingsLoadedHandler;
}
void OnSettingsLoadedHandler (object sender, System.Configuration.SettingsLoadedEventArgs e)
{
if (Settings.Default.UpgradeRequired)
{
Settings.Default.Upgrade();
Settings.Default.UpgradeRequired = false;
Settings.Default.Save();
}
// do not restore in minimized state
if (Settings.Default.winState == System.Windows.WindowState.Minimized)
Settings.Default.winState = System.Windows.WindowState.Normal;
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}