A solution has been obtained for this requirement. To load the OnDemand module at run time, the Info Info object must be added to the directory
ModuleInfo moduleInfo = new ModuleInfo(); moduleInfo.ModuleName = item.Name; moduleInfo.ModuleType = item.Type; moduleInfo.Ref = item.Reference; ModuleCatalog.AddModule(moduleInfo);
The element shown in the above code is populated by calling webservice, which gets into the database and gets the name, type and link (example .xap).
This successfully adds the module directory, the module directory can be referenced in any ViewModel simply by importing this property, as shown below
[Import(AllowRecomposition = false)] public IModuleManager ModuleManager; [Import(AllowRecomposition = false)] public IModuleCatalog ModuleCatalog;
Inorder to load a module while pressing a button or any event, simply call ModuleManager.LoadModule (YourModuleName); and therefore it will be available for use.
source share