SettingsSavedEventHandler

This commit is contained in:
Michael Delpach 2016-02-01 06:21:09 +08:00
parent 84dd0b8d17
commit 7c778ad610

View file

@ -37,6 +37,9 @@ public abstract class SettingsBase<T> where T : SettingsBase<T>, new()
public delegate void SettingsChangedEventHandler(object sender, EventArgs e);
public event SettingsChangedEventHandler SettingsChanged;
public delegate void SettingsSavedEventHandler(object sender, EventArgs e);
public event SettingsSavedEventHandler SettingsSaved;
[Browsable(false)]
public string FilePath { get; private set; }
@ -67,11 +70,18 @@ public virtual void OnSettingsChanged(EventArgs e)
SettingsChanged(this, e);
}
protected virtual void OnSettingsSaved(EventArgs e)
{
if (SettingsSaved != null)
SettingsSaved(this, e);
}
public bool Save(string filePath)
{
FilePath = filePath;
ApplicationVersion = Application.ProductVersion;
OnSettingsSaved(EventArgs.Empty);
return SaveInternal(this, FilePath, true);
}