Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I know it's quite late a response but I am doing something similar, although haven't achieved the full solution yet.</p> <p>This code happens on the click event of a button which I am handling in the presenter. The module is defined in the config file.</p> <pre><code>ModuleInfo moduleInfoObject = this.moduleEnumerator.GetModule("ModuleA"); Assembly assembly = this.LoadAssembly(moduleInfoObject); Type type = assembly.GetType(moduleInfoObject.ModuleType); IModule aModule = this.CreateModule(type); aModule.Initialize(); // - - - -Helper Methods - - - - // - - - LoadAssembly - - - private Assembly LoadAssembly(ModuleInfo moduleInfo) { string assemblyFile = moduleInfo.AssemblyFile; assemblyFile = this.GetModulePath(assemblyFile); FileInfo file = new FileInfo(assemblyFile); Assembly assembly; try { assembly = Assembly.LoadFrom(file.FullName); } catch (Exception ex) { throw new ModuleLoadException(null, assemblyFile, ex.Message, ex); } return assembly; } // LoadAssembly(moduleInfo) // - - - CreateModule - - - private IModule CreateModule(Type type) { return (IModule)containerFacade.Resolve(type); } // CreateModule(type) // - - - GetModulePath - - - private string GetModulePath(string assemblyFile) { if (String.IsNullOrEmpty(assemblyFile)) { throw new ArgumentNullException("assemblyFile"); } // if if (Path.IsPathRooted(assemblyFile) == false) { assemblyFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, assemblyFile); } // if return assemblyFile; } // GetModulePath(assemblyFile) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload