Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to detected the application setting changes?

Tags:

c#

wpf

settings

Is there any way to detected the application setting changes? please help me if there is a good way to detect the settings changes before saving it, i want to get all settings changes and notify the user that there are changes not saved. i did that manually but i want to know if there is a good way. thanks.

like image 637
Henka Programmer Avatar asked Apr 11 '14 16:04

Henka Programmer


1 Answers

You can use the SettingChanging event if you need to know before the change happens:

Properties.Settings.Default.SettingChanging += SettingChanging;

void SettingChanging(object sender, System.Configuration.SettingChangingEventArgs e)
{
    // Do something
}

You can also get the new value by inspecting e.NewValue.

Otherwise use PropertyChanged:

Properties.Settings.Default.PropertyChanged += SettingChanged;

void SettingChanged(object sender, PropertyChangedEventArgs e)
{
    // Do something
}
like image 123
floele Avatar answered Oct 27 '22 20:10

floele