Class PhoenixSettingsManager
Global settings manager for Phoenix.
Implements
Inherited Members
Namespace: Phoenix.Settings
Assembly: Phoenix.Core.dll
Syntax
public class PhoenixSettingsManager : ISettingsManager
Constructors
View SourcePhoenixSettingsManager(IEventAggregator, IPhoenixLogger, String)
Initializes a new instance of the PhoenixSettingsManager class.
Declaration
public PhoenixSettingsManager(IEventAggregator events, IPhoenixLogger logger, string rootDirectory = null)
Parameters
Type | Name | Description |
---|---|---|
IEventAggregator | events | The event aggregator. |
IPhoenixLogger | logger | The logger. |
System.String | rootDirectory | The root for the app data directory for Phoenix. |
Properties
View SourceAppDataDirectoryRoot
Gets a string representing the root for the app data directory for Phoenix.
Declaration
public string AppDataDirectoryRoot { get; }
Property Value
Type | Description |
---|---|
System.String |
ManagedSettings
Gets a mapping from settings category name to each category's settings.
Declaration
protected Dictionary<string, SettingsCategoryBase> ManagedSettings { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, SettingsCategoryBase> |
SettingsCategories
Gets an enumeration of the settings categories.
Declaration
public IEnumerable<SettingsCategoryBase> SettingsCategories { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<SettingsCategoryBase> |
Methods
View SourceChangeSettings(SettingChangeInfo)
Saves a single changed setting to file and settings category object, then publishes an event.
Declaration
public void ChangeSettings(SettingChangeInfo changeInfo)
Parameters
Type | Name | Description |
---|---|---|
SettingChangeInfo | changeInfo | The setting to change. |
ChangeSettings(List<SettingChangeInfo>)
Batch saves changed settings to file and settings category objects, then publishes an event for each settings category affected.
Declaration
public void ChangeSettings(List<SettingChangeInfo> changeInfos)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<SettingChangeInfo> | changeInfos | List of the settings to change. |
HandleLoadException(Exception, SettingsCategoryBase)
Declaration
protected virtual SettingsCategoryBase HandleLoadException(Exception e, SettingsCategoryBase defaultSettingsObject)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | e | |
SettingsCategoryBase | defaultSettingsObject |
Returns
Type | Description |
---|---|
SettingsCategoryBase |
IsValidSettingInfo(SettingChangeInfo)
Checks if setting exists in managed settings.
Declaration
public bool IsValidSettingInfo(SettingChangeInfo setting)
Parameters
Type | Name | Description |
---|---|---|
SettingChangeInfo | setting | setting to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if setting exists. |
LoadSettings<T>()
Load the specified settings from file or load default values if file not found.
Declaration
public T LoadSettings<T>()
where T : SettingsCategoryBase
Returns
Type | Description |
---|---|
T | A SettingsCategory object. |
Type Parameters
Name | Description |
---|---|
T | SettingsCategoryBase type. |
LoadSettings<T>(String)
Load the specified settings from file or load default values if file not found.
Declaration
public T LoadSettings<T>(string settingsName)
where T : SettingsCategoryBase
Parameters
Type | Name | Description |
---|---|---|
System.String | settingsName | Name of the settings to load. |
Returns
Type | Description |
---|---|
T | A SettingsCategory object. |
Type Parameters
Name | Description |
---|---|
T | SettingsCategoryBase type. |
LogLoadException(Exception, String)
Declaration
protected void LogLoadException(Exception e, string categoryName)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | e | |
System.String | categoryName |
SaveSettingsToFile(SettingsCategoryBase)
Declaration
protected void SaveSettingsToFile(SettingsCategoryBase settingsCategory)
Parameters
Type | Name | Description |
---|---|---|
SettingsCategoryBase | settingsCategory |