ModuleManager

Overview

The ModuleManager class is a core class for the .NET host applications. This class is used by host applications to load and manage plugin modules. For more information about creating host applications please refere to this article.

Use Case

You will use this class in your .NET host applications to deal with plugins, for example:

    private void Main_Load(object sender, EventArgs e)
    {
      moduleManager.LoadModule("Plugin.dll");
      Instance = moduleManager.CreateInstance("MyPlugin");
      hostPanel1.HostPlugin(Instance as IBasePlugin);
    }

Location


 

constructor

Creates an instance of the class.

 

constructor

 

ModuleManager()

 

Sub New()

CreateInstance (String): IHYCrossPlatformPlugin

 

method CreateInstance(name: String): IHYCrossPlatformPlugin

 

IHYCrossPlatformPlugin CreateInstance(String name)

 

Function CreateInstance(name As String) As IHYCrossPlatformPlugin

Parameters:

  • name:

Loads managed plugin module with given file name.

 

method CreateInstance(pluginDescriptor: PluginDescriptor): IHYCrossPlatformPlugin

 

IHYCrossPlatformPlugin CreateInstance(PluginDescriptor pluginDescriptor)

 

Function CreateInstance(pluginDescriptor As PluginDescriptor) As IHYCrossPlatformPlugin

Parameters:

  • pluginDescriptor: Reference to a module.

Host

Gets or sets reference to a host object. Setting this referece will allow module manager to assign it to every module that is being loaded and to every instance that you will create.

 

property Host: IHYCrossPlatformHost read write;

 

IHYCrossPlatformHost Host { get; set; }

 

Property Host() As IHYCrossPlatformHost

LoadFiremonkeyModule

Loads a FireMonkey plugin module.

 

method LoadFiremonkeyModule(filename: String): LoadedFiremonkeyModule

 

LoadedFiremonkeyModule LoadFiremonkeyModule(String filename)

 

Function LoadFiremonkeyModule(filename As String) As LoadedFiremonkeyModule

Parameters:

  • filename: Path to a plugin module.

LoadJavaModule

 

method LoadJavaModule(filename: String): LoadedJavaModule

 

LoadedJavaModule LoadJavaModule(String filename)

 

Function LoadJavaModule(filename As String) As LoadedJavaModule

Parameters:

  • filename:

LoadManagedModule (array of Byte): LoadedManagedModule

Loads managed plugin module from the array. Deprecated only for backward compatibility.

 

method LoadManagedModule(aAssembly: array of Byte): LoadedManagedModule

 

LoadedManagedModule LoadManagedModule(Byte[] aAssembly)

 

Function LoadManagedModule(aAssembly As Byte()) As LoadedManagedModule

Parameters:

  • aAssembly: A byte array that is a COFF-based image containing an emitted assembly.

LoadManagedModule (Assembly): LoadedManagedModule

Loads managed plugin module from a pre-loaded assembly.

 

method LoadManagedModule(aAssembly: Assembly): LoadedManagedModule

 

LoadedManagedModule LoadManagedModule(Assembly aAssembly)

 

Function LoadManagedModule(aAssembly As Assembly) As LoadedManagedModule

Parameters:

  • aAssembly: Reference to a pre-loaded assembly.

LoadManagedModule (String): LoadedManagedModule

 

method LoadManagedModule(filename: String): LoadedManagedModule

 

LoadedManagedModule LoadManagedModule(String filename)

 

Function LoadManagedModule(filename As String) As LoadedManagedModule

Parameters:

  • filename:

LoadManagedModule (String, Boolean): LoadedManagedModule

 

method LoadManagedModule(filename: String; inNewAppDomain: Boolean): LoadedManagedModule

 

LoadedManagedModule LoadManagedModule(String filename, Boolean inNewAppDomain)

 

Function LoadManagedModule(filename As String, inNewAppDomain As Boolean) As LoadedManagedModule

Parameters:

  • filename:
  • inNewAppDomain:

LoadModule (String): LoadedModule

 

method LoadModule(filename: String): LoadedModule

 

LoadedModule LoadModule(String filename)

 

Function LoadModule(filename As String) As LoadedModule

Parameters:

  • filename:

LoadModule (String, Boolean): LoadedModule

 

method LoadModule(filename: String; inNewAppDomain: Boolean): LoadedModule

 

LoadedModule LoadModule(String filename, Boolean inNewAppDomain)

 

Function LoadModule(filename As String, inNewAppDomain As Boolean) As LoadedModule

Parameters:

  • filename:
  • inNewAppDomain:

LoadSilverlightModule

 

method LoadSilverlightModule(filename: String): LoadedSilverlightModule

 

LoadedSilverlightModule LoadSilverlightModule(String filename)

 

Function LoadSilverlightModule(filename As String) As LoadedSilverlightModule

Parameters:

  • filename:

LoadUnmanagedModule

 

method LoadUnmanagedModule(filename: String): LoadedUnmanagedModule

 

LoadedUnmanagedModule LoadUnmanagedModule(String filename)

 

Function LoadUnmanagedModule(filename As String) As LoadedUnmanagedModule

Parameters:

  • filename:

ModuleLoaded

This event is fired when the module is loaded.

 

event ModuleLoaded: EventHandler<ModuleLoadedEventArgs>;

 

delegate EventHandler<ModuleLoadedEventArgs> ModuleLoaded()

 

Event ModuleLoaded As EventHandler<ModuleLoadedEventArgs>

ModuleLoading

This event is fired before loading the module.

 

event ModuleLoading: EventHandler<ModuleLoadingEventArgs>;

 

delegate EventHandler<ModuleLoadingEventArgs> ModuleLoading()

 

Event ModuleLoading As EventHandler<ModuleLoadingEventArgs>

Modules

Collection of all modules that are loaded into the current ModuleManager.

 

property Modules: ICollection read;

 

ICollection Modules { get; }

 

ReadOnly Property Modules() As ICollection

Plugins

List of all plugin descriptors contained in plugin modules.

 

property Plugins: PluginList read;

 

PluginList Plugins { get; }

 

ReadOnly Property Plugins() As PluginList

TryLoadModule

 

method TryLoadModule(filename: String): LoadedModule

 

LoadedModule TryLoadModule(String filename)

 

Function TryLoadModule(filename As String) As LoadedModule

Parameters:

  • filename:

UnloadModule

Loads managed plugin module with given file name.

 

method UnloadModule(module: LoadedModule)

 

void UnloadModule(LoadedModule module)

 

Sub UnloadModule(module As LoadedModule)

Parameters:

  • module: Reference to a module.

 

Host

Gets or sets reference to a host object. Setting this referece will allow module manager to assign it to every module that is being loaded and to every instance that you will create.

 

property Host: IHYCrossPlatformHost read write;

 

IHYCrossPlatformHost Host { get; set; }

 

Property Host() As IHYCrossPlatformHost

Modules

Collection of all modules that are loaded into the current ModuleManager.

 

property Modules: ICollection read;

 

ICollection Modules { get; }

 

ReadOnly Property Modules() As ICollection

Plugins

List of all plugin descriptors contained in plugin modules.

 

property Plugins: PluginList read;

 

PluginList Plugins { get; }

 

ReadOnly Property Plugins() As PluginList

 

constructor

Creates an instance of the class.

 

constructor

 

ModuleManager()

 

Sub New()

CreateInstance (String): IHYCrossPlatformPlugin

 

method CreateInstance(name: String): IHYCrossPlatformPlugin

 

IHYCrossPlatformPlugin CreateInstance(String name)

 

Function CreateInstance(name As String) As IHYCrossPlatformPlugin

Parameters:

  • name:

Loads managed plugin module with given file name.

 

method CreateInstance(pluginDescriptor: PluginDescriptor): IHYCrossPlatformPlugin

 

IHYCrossPlatformPlugin CreateInstance(PluginDescriptor pluginDescriptor)

 

Function CreateInstance(pluginDescriptor As PluginDescriptor) As IHYCrossPlatformPlugin

Parameters:

  • pluginDescriptor: Reference to a module.

LoadFiremonkeyModule

Loads a FireMonkey plugin module.

 

method LoadFiremonkeyModule(filename: String): LoadedFiremonkeyModule

 

LoadedFiremonkeyModule LoadFiremonkeyModule(String filename)

 

Function LoadFiremonkeyModule(filename As String) As LoadedFiremonkeyModule

Parameters:

  • filename: Path to a plugin module.

LoadJavaModule

 

method LoadJavaModule(filename: String): LoadedJavaModule

 

LoadedJavaModule LoadJavaModule(String filename)

 

Function LoadJavaModule(filename As String) As LoadedJavaModule

Parameters:

  • filename:

LoadManagedModule (array of Byte): LoadedManagedModule

Loads managed plugin module from the array. Deprecated only for backward compatibility.

 

method LoadManagedModule(aAssembly: array of Byte): LoadedManagedModule

 

LoadedManagedModule LoadManagedModule(Byte[] aAssembly)

 

Function LoadManagedModule(aAssembly As Byte()) As LoadedManagedModule

Parameters:

  • aAssembly: A byte array that is a COFF-based image containing an emitted assembly.

LoadManagedModule (Assembly): LoadedManagedModule

Loads managed plugin module from a pre-loaded assembly.

 

method LoadManagedModule(aAssembly: Assembly): LoadedManagedModule

 

LoadedManagedModule LoadManagedModule(Assembly aAssembly)

 

Function LoadManagedModule(aAssembly As Assembly) As LoadedManagedModule

Parameters:

  • aAssembly: Reference to a pre-loaded assembly.

LoadManagedModule (String): LoadedManagedModule

 

method LoadManagedModule(filename: String): LoadedManagedModule

 

LoadedManagedModule LoadManagedModule(String filename)

 

Function LoadManagedModule(filename As String) As LoadedManagedModule

Parameters:

  • filename:

LoadManagedModule (String, Boolean): LoadedManagedModule

 

method LoadManagedModule(filename: String; inNewAppDomain: Boolean): LoadedManagedModule

 

LoadedManagedModule LoadManagedModule(String filename, Boolean inNewAppDomain)

 

Function LoadManagedModule(filename As String, inNewAppDomain As Boolean) As LoadedManagedModule

Parameters:

  • filename:
  • inNewAppDomain:

LoadModule (String): LoadedModule

 

method LoadModule(filename: String): LoadedModule

 

LoadedModule LoadModule(String filename)

 

Function LoadModule(filename As String) As LoadedModule

Parameters:

  • filename:

LoadModule (String, Boolean): LoadedModule

 

method LoadModule(filename: String; inNewAppDomain: Boolean): LoadedModule

 

LoadedModule LoadModule(String filename, Boolean inNewAppDomain)

 

Function LoadModule(filename As String, inNewAppDomain As Boolean) As LoadedModule

Parameters:

  • filename:
  • inNewAppDomain:

LoadSilverlightModule

 

method LoadSilverlightModule(filename: String): LoadedSilverlightModule

 

LoadedSilverlightModule LoadSilverlightModule(String filename)

 

Function LoadSilverlightModule(filename As String) As LoadedSilverlightModule

Parameters:

  • filename:

LoadUnmanagedModule

 

method LoadUnmanagedModule(filename: String): LoadedUnmanagedModule

 

LoadedUnmanagedModule LoadUnmanagedModule(String filename)

 

Function LoadUnmanagedModule(filename As String) As LoadedUnmanagedModule

Parameters:

  • filename:

TryLoadModule

 

method TryLoadModule(filename: String): LoadedModule

 

LoadedModule TryLoadModule(String filename)

 

Function TryLoadModule(filename As String) As LoadedModule

Parameters:

  • filename:

UnloadModule

Loads managed plugin module with given file name.

 

method UnloadModule(module: LoadedModule)

 

void UnloadModule(LoadedModule module)

 

Sub UnloadModule(module As LoadedModule)

Parameters:

  • module: Reference to a module.

 

ModuleLoaded

This event is fired when the module is loaded.

 

event ModuleLoaded: EventHandler<ModuleLoadedEventArgs>;

 

delegate EventHandler<ModuleLoadedEventArgs> ModuleLoaded()

 

Event ModuleLoaded As EventHandler<ModuleLoadedEventArgs>

ModuleLoading

This event is fired before loading the module.

 

event ModuleLoading: EventHandler<ModuleLoadingEventArgs>;

 

delegate EventHandler<ModuleLoadingEventArgs> ModuleLoading()

 

Event ModuleLoading As EventHandler<ModuleLoadingEventArgs>