in my test application, the ModuleCatalog is populated from the specified directory with all my modules in it. What I'd like to do is to add the name of all these moudles to a Menu as menuitems, e.g. if I have 3 modules in the directory, the menu will show 3 menuitems with the name of modules. I thought I can get the list of ModuleInfo like below. But miList shows 0 count. What is the problem here?
protected override void ConfigureModuleCatalog()
{
DirectoryModuleCatalog directoryCatalog = new DirectoryModuleCatalog()
{ ModulePath = @".\Modules" };
((AggregateModuleCatalog)ModuleCatalog).AddCatalog(directoryCatalog);
List<ModuleInfo> miList = ModuleCatalog.Modules.ToList() ; // returns 0 items ??
}
The list of the modules will be populated after InitializeModules has run later on during the bootstrapping process. InitializeModules calls ModuleManager.Run().
You could populate your menu in your shell after it has loaded (get ahold of the ModuleCatalog through the ServiceLocator.Current) You could also populate your menu in the OnPopup event.