Silverlight PRISM Create a directory of custom modules

I created a Silverlight application with PRISM and MEF. Is there a way to populate the module directory through some kind of web service or database call? The example shown in the PRISM documentation retrieves module information through an XAP file that is included in the Shell project. In my case, I need to get this list from some service. I read several articles that suggested creating your own ModuleCatalog module that implements IModuleCatalog.

I can not find any example or piece of code on how to proceed. Any suggestions on how to do this?

Thanks Deepak

+1
source share
1 answer

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.

+1
source

Source: https://habr.com/ru/post/1303678/


All Articles