Acts as a base class for deriving concrete wrapper classes to implement the application settings feature in Window Forms applications.
Assembly: System (in System.dll)
Initializes an instance of theclass to its default state.
Initializes an instance of theclass using the supplied owner component.
Initializes an instance of theclass using the supplied owner component and settings key.
Initializes an instance of theclass using the supplied settings key.
Gets the application settings context associated with the settings group.(Overrides SettingsBase.Context.)
Gets a value indicating whether access to the object is synchronized (thread safe). (Inherited from SettingsBase.)
Gets or sets the value of the specified application settings property.(Overrides SettingsBase.Item(String).)
Gets the collection of settings properties in the wrapper.(Overrides SettingsBase.Properties.)
Gets a collection of property values.(Overrides SettingsBase.PropertyValues.)
Gets the collection of application settings providers used by the wrapper.(Overrides SettingsBase.Providers.)
Gets or sets the settings key for the application settings group.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)
Serves as the default hash function. (Inherited from Object.)
Returns the value of the named settings property for the previous version of the same application.
|Initialize(SettingsContext, SettingsPropertyCollection, SettingsProviderCollection)|
Raises the PropertyChanged event.
Raises the SettingChanging event.
Raises the SettingsLoaded event.
Raises the SettingsSaving event.
Refreshes the application settings property values from persistent storage.
Restores the persisted application settings values to their corresponding default properties.
Stores the current values of the application settings properties.(Overrides SettingsBase.Save().)
Returns a string that represents the current object.(Inherited from Object.)
Updates application settings to reflect a more recent installation of the application.
Occurs after the value of an application settings property is changed.
Occurs before the value of an application settings property is changed.
Occurs after the application settings are retrieved from storage.
Occurs before values are saved to the data store.
SettingsBase class, which is used by Web-based applications:adds the following functionality to the
The ability to detect attributes on a derived, settings wrapper class.supports the declarative model used for wrapper class properties, as described later.
Additional validation events that you can handle to ensure the correctness of individual settings.
In the application settings architecture, to access a group of settings properties you need to derive a concrete wrapper class from. The wrapper class customizes in the following ways:
For every settings property to be accessed, a corresponding strongly typed public property is added to the wrapper class. This property has get and set accessors for read/write application settings, but only a get accessor for read-only settings.
Appropriated attributes must be applied to the wrapper class's public properties to indicate characteristics of the settings property, such as the setting's scope (application or user), whether the setting should support roaming, the default value for the setting, the settings provider to be used, and so on. Each property is required to specify its scope, using either ApplicationScopedSettingAttribute or UserScopedSettingAttribute. Application-scoped settings are read-only if the default LocalFileSettingsProvider is used.
Theclass uses reflection to detect these attributes at run time. Most of this information gets passed to the settings provider layer, which is responsible for storage, persistence format, and so on.
When an application has multiple settings wrapper classes, each class defines a settings group. Each group has the following characteristics:
A group can contain any number or type of property settings.
If the group name is not explicitly set by the decorating the wrapper class with a SettingsGroupNameAttribute, then a name is automatically generated.
By default, all client-based applications use the LocalFileSettingsProvider to provide storage. If an alternate settings provider is desired, then the wrapper class or property must be decorated with a corresponding SettingsProviderAttribute.
For more information about using application settings, see Application Settings for Windows Forms.
The following code example demonstrates the use of application settings to persist the following attributes of the main form: location, size, background color, and title bar text. All of these attributes are persisted as single application settings properties in the FormSettings class, named FormLocation, FormSize, FormBackColor and FormText, respectively. All except for FormText and Size are data bound to their associated form properties and have a default setting value applied using DefaultSettingValueAttribute.
The form contains four child controls that have the following names and functions:
A button named btnBackColor used to display the Color common dialog box.
A button named btnReload used to Reload the application settings.
A button named btnReset used to Reset the application settings.
A textbox named tbStatus used to display status information about the program.
Notice that after every execution of the application, an additional period character is appended to the title text of the form.
This code example requires a Form with a ColorDialog class named colorDialog1, and a StatusStrip control with a ToolStripStatusLabel named tbStatus. Additionally, it requires three Button objects named btnReload, btnReset, and btnBackColor.
Available since 2.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.