Class SettingsManager
Implements methods to manage settings.
Inheritance
Implements
Namespace: Sartorius.SAF.Settings
Assembly: Sartorius.SAF.dll
Syntax
[Export(typeof(ISettingsManager))]
public class SettingsManager : ISettingsManager
Examples
The SettingsManager uses the ISettingService to store the settings. See the examples for the ISettingService and its SAF implementation to set required and optional settings to control the behavior how and where the settings are stored.
Constructors
View SourceSettingsManager(IServiceFactory)
Initializes a new instance of the SettingsManager class.
Declaration
[ImportingConstructor]
public SettingsManager(IServiceFactory serviceFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceFactory | serviceFactory | An instance of IServiceFactory. |
Properties
View SourceIsActive
Indicates whether the ISettingsManager is active.
Declaration
public bool IsActive { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
Might be inactive if there is no underlying implementation of the ISettingService.
Methods
View SourceDeleteSetting(SettingScope, String)
Deletes the setting with the given key.
Declaration
public void DeleteSetting(SettingScope settingScope, string key)
Parameters
| Type | Name | Description |
|---|---|---|
| SettingScope | settingScope | The SettingScope. |
| System.String | key | The setting key. |
Examples
settingsManager.DeleteSetting(SettingScope.Application, "SystemCulture");
View Source
ReadSetting<T>(SettingScope, String)
Reads the setting with the given key.
Declaration
public T ReadSetting<T>(SettingScope settingScope, string key)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| SettingScope | settingScope | The SettingScope. |
| System.String | key | The setting key. |
Returns
| Type | Description |
|---|---|
| T | The setting, or null if not setting was found. |
Type Parameters
| Name | Description |
|---|---|
| T |
ReadUserSetting<T>(String)
Reads the user setting with the given key.
Declaration
public T ReadUserSetting<T>(string key)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | The setting key. |
Returns
| Type | Description |
|---|---|
| T | The setting or null if not setting was found. |
Type Parameters
| Name | Description |
|---|---|
| T |
SaveSetting(SettingScope, String, Object)
Saves a setting with the given key.
Declaration
public void SaveSetting(SettingScope settingScope, string key, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| SettingScope | settingScope | The SettingScope. |
| System.String | key | The setting key. |
| System.Object | value | The setting value. |
SaveUserSetting(String, Object)
Saves a user setting with the given key.
Declaration
public void SaveUserSetting(string key, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | The setting key. |
| System.Object | value | The setting value. |