Interface ISettingsGroup
A group of individual setting values
Namespace: Sdl.Core.Settings
Assembly: Sdl.Core.Settings.dll
Syntax
public interface ISettingsGroup
Properties
EventsSuspended
True if event notifications have been suspended.
Declaration
bool EventsSuspended { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Id
Gets the id of the settings group.
Declaration
string Id { get; }
Property Value
Type | Description |
---|---|
System.String |
Parent
Gets the parent settings group in the parent bundle, or null if this settings group belongs to the root settings bundle.
Declaration
ISettingsGroup Parent { get; }
Property Value
Type | Description |
---|---|
ISettingsGroup |
SettingsBundle
Gets the bundle this settings group belongs to
Declaration
ISettingsBundle SettingsBundle { get; }
Property Value
Type | Description |
---|---|
ISettingsBundle |
Methods
ContainsSetting(String)
Returns true when this settings group or an ancestor settings group contains a value for the specified setting.
Declaration
bool ContainsSetting(string settingId)
Parameters
Type | Name | Description |
---|---|---|
System.String | settingId | The id of the setting. |
Returns
Type | Description |
---|---|
System.Boolean | True if this settings group or an ancestor contains a value for the specified setting. |
GetSetting<T>(String)
Gets the setting with the specified id.
Declaration
Setting<T> GetSetting<T>(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The id of the setting. |
Returns
Type | Description |
---|---|
Setting<T> | The setting. |
Type Parameters
Name | Description |
---|---|
T | The type of the setting value. |
Remarks
When no value is defined in the settings group itself, the parent chain is searched for an inherited value. If no inherited value can be found, the default value provided by the settings group implementation is returned.
GetSetting<T>(String, T)
Gets the setting with the specified id.
Declaration
Setting<T> GetSetting<T>(string settingId, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | settingId | The id of the setting. |
T | defaultValue | The default value for the setting if no value can be found. |
Returns
Type | Description |
---|---|
Setting<T> | The setting. |
Type Parameters
Name | Description |
---|---|
T | The type of the setting value. |
Remarks
When no value is defined in the settings group itself, the parent chain is searched for an inherited value. If no inherited value can be found, the default value provided by the settings group implementation is returned.
GetSetting<T>(String, out T)
Gets the setting with the specified id.
Declaration
bool GetSetting<T>(string settingId, out T value)
Parameters
Type | Name | Description |
---|---|---|
System.String | settingId | The id of the setting. |
T | value | The value of the setting. |
Returns
Type | Description |
---|---|
System.Boolean | True if a setting value has been returned. |
Type Parameters
Name | Description |
---|---|
T | The type of the setting value. |
Remarks
When no value is defined in the settings group itself, the parent chain is searched for an inherited value. If no inherited value can be found, null is returned.
GetSetting<T>(String, out Setting<T>)
Gets the setting with the specified id.
Declaration
bool GetSetting<T>(string settingId, out Setting<T> setting)
Parameters
Type | Name | Description |
---|---|---|
System.String | settingId | The id of the setting. |
Setting<T> | setting | The setting, or null if no value was defined. |
Returns
Type | Description |
---|---|
System.Boolean | True if a setting value has been returned. |
Type Parameters
Name | Description |
---|---|
T | The type of the setting value. |
Remarks
When no value is defined in the settings group itself, the parent chain is searched for an inherited value. If no inherited value can be found, null is returned.
GetSettingIds()
Gets the setting ids from the current settings group.
Declaration
IEnumerable<string> GetSettingIds()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | The setting ids. |
ImportSettings(ISettingsGroup)
Imports the settings from another group into this one. Resets the current settings in this group before importing the settings from the other group.
Declaration
void ImportSettings(ISettingsGroup otherGroup)
Parameters
Type | Name | Description |
---|---|---|
ISettingsGroup | otherGroup | The group which the settings are imported from |
RemoveSetting(String)
Removes a local setting from the this group. Returns true if the setting was successfully removed, false otherwise. i.e. if the setting doesn't exist, false is returned.
Declaration
bool RemoveSetting(string settingId)
Parameters
Type | Name | Description |
---|---|---|
System.String | settingId | The id of the setting to remove |
Returns
Type | Description |
---|---|
System.Boolean | boolean indicating whether the setting was successfully removed |
Reset()
Resets all settings locally defined in this settings group.
Declaration
void Reset()
ResumeEvents()
Resumes event notification. This raises the SettingsChanged event once this method has been called an equal amount of times as SuspendEvents().
Declaration
void ResumeEvents()
SuspendEvents()
Suspends event notification.
Declaration
void SuspendEvents()
Remarks
This method can be aclled multiple times. Until the ResumeEvents() has been called the same number of times, no event will be raised.
Events
SettingsChanged
Raised when a setting value changes.
Declaration
event EventHandler<SettingsChangedEventArgs> SettingsChanged
Event Type
Type | Description |
---|---|
System.EventHandler<SettingsChangedEventArgs> |
Remarks
This event is also raised if an inherited settings value changes.