This question was also posted on Prism's site on Codeplex.
I am a little lost on loading modules on demand, and I hope you guys can enlighten me. I am using v2 #7.
Here's what I want to accomplish:
1) I have 2 regions - one for buttons that instantiate the modules (MenuRegion), another to show the modules (MainRegion). Only one module is to be visible at a time in MenuRegion.
2) Modules are to be found in a directory
3) The MenuModule module is associated with MenuRegion and is to create buttons showing the module names. When one of the buttons is clicked, the corresponding module is to be loaded and displayed in MainRegion.
4) Behavior:
a) ModuleA button is clicked and ModuleA is displayed. User enters data in ModuleA and data is left in an unsaved state.
b) ModuleB button is clicked and ModuleB is displayed. User enters data in ModuleB and data is left in an unsaved state.
c) ModuleA button is click and ModuleA is displayed with the information previously entered.
Please correct me if I am wrong in my assumptions, and please give me other suggestions:
1) MainRegion should be a ContentControl, so only one module is visible at a time.
2) I think I need to enumerate the "GrouplessModules" of my Catalog to get the ModuleInfo for the modules available in the directory
3) To load the module I think I need to call myModuleManager.LoadModule(moduleName)
Finally, my questions:
1) Should I have the moduleManager as a parameter in my MenuModuleView's constructor?
2) How do I get the catalog accessible from inside MenuModuleView, in order to enumerate the available modules?
3) From MenuModuleView, as I enumerate through the modules, I create the buttons, assigning the ModuleInfo to the button's Tag property. This way, I have only one click event to load the module. Is this correct? It smells a bit work-aroundish to me...
Thanks a lot for your help!!!