Class ModuleManager
Component responsible for coordinating the modules' type loading and module initialization process.
Namespace: Sartorius.SAF.Presentation.Modularity
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public class ModuleManager : IModuleManager, IDisposable
Constructors
View SourceModuleManager(IModuleInitializer, IModuleCatalog)
Initializes an instance of the ModuleManager class.
Declaration
public ModuleManager(IModuleInitializer moduleInitializer, IModuleCatalog moduleCatalog)
Parameters
| Type | Name | Description |
|---|---|---|
| IModuleInitializer | moduleInitializer | Service used for initialization of modules. |
| IModuleCatalog | moduleCatalog | Catalog that enumerates the modules to be loaded and initialized. |
Properties
View SourceModuleCatalog
The module catalog specified in the constructor.
Declaration
protected IModuleCatalog ModuleCatalog { get; }
Property Value
| Type | Description |
|---|---|
| IModuleCatalog |
ModuleTypeLoaders
Returns the list of registered IModuleTypeLoader instances that will be used to load the types of modules.
Declaration
public virtual IEnumerable<IModuleTypeLoader> ModuleTypeLoaders { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<IModuleTypeLoader> | The module type loaders. |
Methods
View SourceDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Remarks
Calls Dispose(Boolean)
Dispose(Boolean)
Disposes the associated IModuleTypeLoaders.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing | When true, it is being called from the Dispose method. |
HandleModuleTypeLoadingError(ModuleInfo, Exception)
Handles any exception occurred in the module type loading process. This method can be overriden to provide a different behavior.
Declaration
protected virtual void HandleModuleTypeLoadingError(ModuleInfo moduleInfo, Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| ModuleInfo | moduleInfo | The module metadata where the error happened. |
| System.Exception | exception | The exception thrown that is the cause of the current error. |
Exceptions
| Type | Condition |
|---|---|
| ModuleTypeLoadingException |
LoadModule(String)
Loads and initializes the module on the ModuleCatalog with the name moduleName.
Declaration
public void LoadModule(string moduleName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | moduleName | Name of the module requested for initialization. |
LoadModulesThatAreReadyForLoad()
Loads the modules that are not intialized and have their dependencies loaded.
Declaration
protected void LoadModulesThatAreReadyForLoad()
ModuleNeedsRetrieval(ModuleInfo)
Checks if the module needs to be retrieved before it's initialized.
Declaration
protected virtual bool ModuleNeedsRetrieval(ModuleInfo moduleInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| ModuleInfo | moduleInfo | Module that is being checked if needs retrieval. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Run()
Initializes the modules marked as WhenAvailable on the ModuleCatalog.
Declaration
public void Run()
Events
View SourceLoadModuleCompleted
Raised when a module is loaded or fails to load.
Declaration
public event EventHandler<LoadModuleCompletedEventArgs> LoadModuleCompleted
Event Type
| Type | Description |
|---|---|
| System.EventHandler<LoadModuleCompletedEventArgs> |
ModuleDownloadProgressChanged
Raised repeatedly to provide progress as modules are loaded in the background.
Declaration
public event EventHandler<ModuleDownloadProgressChangedEventArgs> ModuleDownloadProgressChanged
Event Type
| Type | Description |
|---|---|
| System.EventHandler<ModuleDownloadProgressChangedEventArgs> |