<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0-preview.2.23128.3" />

ApplicationSettingsBase

Base settings class for client applications.
public string SettingsKey { get; set; }

Derived classes should use this to uniquely identify separate instances of settings classes.

Fires when the value of a setting is changed. (INotifyPropertyChanged implementation.)

Fires when the value of a setting is about to change. This is a cancellable event.

Fires when settings are retrieved from a provider. It fires once for each provider.

Fires when Save() is called. This is a cancellable event.

Default constructor without a concept of "owner" component.

Constructor that takes an IComponent. The IComponent acts as the "owner" of this settings class. One of the things we do is query the component's site to see if it has a SettingsProvider service. If it does, we allow it to override the providers specified in the metadata.

protected ApplicationSettingsBase(string settingsKey)

Convenience overload that takes the settings key

protected ApplicationSettingsBase(IComponent owner, string settingsKey)

Convenience overload that takes the owner component and settings key.

public object GetPreviousVersion(string propertyName)

Used in conjunction with Upgrade - retrieves the previous value of a setting from the provider. Provider must implement IApplicationSettingsProvider to support this.

protected virtual void OnPropertyChanged(object sender, PropertyChangedEventArgs e)

Fires the PropertyChanged event.

protected virtual void OnSettingChanging(object sender, SettingChangingEventArgs e)

Fires the SettingChanging event.

protected virtual void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e)

Fires the SettingsLoaded event.

protected virtual void OnSettingsSaving(object sender, CancelEventArgs e)

Fires the SettingsSaving event.

public void Reload()

Causes a reload to happen on next setting access, by clearing the cached values.

public void Reset()

Calls Reset on the providers. Providers must implement IApplicationSettingsProvider to support this.

public virtual void Upgrade()

Called when the app is upgraded so that we can instruct the providers to upgrade their settings. Providers must implement IApplicationSettingsProvider to support this.