Class ModulesService
Service for create, save and load a configuration.
Implements
Inherited Members
Namespace: Loehnert.Lisrt.Modules
Assembly: Loehnert.Lisrt.Modules.dll
Syntax
[Export(typeof(IModulesService))]
public class ModulesService : PropertyChangedBase, INotifyPropertyChangedEx, IModulesService, INotifyPropertyChanged
Constructors
ModulesService(ILisrtModule[], IConfigurationManager, IStringConverter)
Initializes a new instance of the ModulesService class.
Declaration
[ImportingConstructor]
public ModulesService([ImportMany("RootModule")] ILisrtModule[] rootModules, IConfigurationManager configurationManager, IStringConverter propertyConverter)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule[] | rootModules | Root module, without Parent. |
IConfigurationManager | configurationManager | Manager for loading and saving IModuleConfigurations. |
IStringConverter | propertyConverter | String converter for the properties. |
Fields
RootModuleName
Gets the name for the root module.
Declaration
public const string RootModuleName = "RootModule"
Field Value
Type | Description |
---|---|
String |
Properties
ConfigurationManager
Gets the IConfigurationManager for loading and saving a IModuleConfiguration.
Declaration
public IConfigurationManager ConfigurationManager { get; }
Property Value
Type | Description |
---|---|
IConfigurationManager |
Remarks
XmlConfigurationManager by default.
CurrentConfigurationName
Gets the name of the current ModuleConfiguration or null.
Declaration
public string CurrentConfigurationName { get; }
Property Value
Type | Description |
---|---|
String |
ModuleConfigurations
Gets the latest loaded configurations of the root modules.
Declaration
public IEnumerable<IModuleConfiguration> ModuleConfigurations { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IModuleConfiguration> |
PropertyConverter
Gets the string converter to convert property values.
Declaration
public IStringConverter PropertyConverter { get; }
Property Value
Type | Description |
---|---|
IStringConverter |
Remarks
StringConverter by default.
RootModules
Gets or sets the "RootModules".ILisrtModule.
Declaration
public ILisrtModule[] RootModules { get; set; }
Property Value
Type | Description |
---|---|
ILisrtModule[] |
Methods
LoadConfigurationToRootModule()
Opens a dialog and loads the ModuleConfiguration to the RootModules with ConfigurationManager and new initialization.
Declaration
public bool LoadConfigurationToRootModule()
Returns
Type | Description |
---|---|
Boolean | True if all ILisrtModules with their sub modules and properties could be loaded to the target. |
Remarks
Opens usually a dialog to choose a path. ExitRecursively(ILisrtModule, Boolean), ApplyToModule(ILisrtModule, IStringConverter) and Initialize() the RootModule.
LoadConfigurationToRootModule(String)
Loads the ModuleConfiguration from the path
to the RootModules using ConfigurationManager and new initialization.
Declaration
public bool LoadConfigurationToRootModule(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | Path to the configuration file. |
Returns
Type | Description |
---|---|
Boolean | True if all ILisrtModules with their sub modules and properties could be loaded to the target. |
Remarks
ExitRecursively(ILisrtModule, Boolean), ApplyToModule(ILisrtModule, IStringConverter) and Initialize() the RootModule.
SaveConfigurationFromRootModule()
Saves the ModuleConfiguration from RootModules with ConfigurationManager.
Declaration
public void SaveConfigurationFromRootModule()
Remarks
Opens usually a dialog to choose a path.