Is there a way to detect application settings changes?

Is there a way to detect application settings changes? please help me if there is a good way to detect changes in settings before saving, I want all changes to be changed and notify the user that the changes are not saved. I did it manually, but I want to know if there is a good way. thank.

+4
source share
1 answer

You can use the event SettingChangingif you need to know before the change occurs:

Properties.Settings.Default.SettingChanging += SettingChanging;

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

You can also get a new value by checking e.NewValue.

Otherwise use PropertyChanged:

Properties.Settings.Default.PropertyChanged += SettingChanged;

void SettingChanged(object sender, PropertyChangedEventArgs e)
{
    // Do something
}
+7

Source: https://habr.com/ru/post/1536144/


All Articles