+4  A: 

1) Should I have the moduleManager as a parameter in my MenuModuleView's constructor?

Technically you could. Practically speaking though, if you do this you will still want to define a default constructor for your view. Otherwise, your view will not work in designers. Therefore, I recommend that properties be used to pass in dependencies to UI components.

2) How do I get the catalog accessible from inside MenuModuleView, in order to enumerate the available modules?

You would depend on Prism's IModuleEnumerator interface and dependency injection will take care of supplying the module enumerator to your view. Assuming you're using Prism with the Unity container, that would look something like this:

[Dependency]
public IModuleEnumerator ModuleEnumerator 
{
    get; set;
}

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..

I would suggest you have each button raise the same WPF command and instead assign the ModuleInfo to the Button's CommandParameter property. Again, Prism has infrastructure to help you do this cleanly in a composite scenario. See the DelegateCommand class.

As a final note, be aware that whilst you may be able to lazily load your modules, you won't be able to unload them. For that, you will require AppDomain isolation, which is a whole other kettle of fish.

HTH, Kent

Kent Boogaart
Doesn't the Prism RegionManager take care of switching the views in a ContentControl? I thought that was the point of the Region stuff. If you want a different control visible you just activate it in the region and the adapter takes care of the rest.
Cameron MacFarland
Yeah, you're probably right - thanks. I wasn't thinking straight. Will update my post.
Kent Boogaart
Kent, isn't the dependency injection mechanism driven by the parameters in the constructors? Doesn't your suggestion of passing dependencies through properties go against the idea of DI? I just don't know much about the topic yet, this is just based on the Prism documentation/source code.
Gustavo Cavalcanti
+1  A: 

Kent, Thanks a lot for your answer. It really gave me a lot of insight. I didn't know about not being able to unload a module. That's a deal braker for me, as I wanted to build a portal application with Prism. It needs to load/unload applications inside the shell, not just deactivate them. Thanks again.

Gustavo Cavalcanti
Not sure why you need to unload modules. Prism is not set up to do this by default. You could modify the module loader to load into separate app domains, but the problem is what is responsible for unloading modules and how do modules clean up themselves when they are unloaded?
Cameron MacFarland
You're welcome Gustavo. Please mark my question as the answer if it sufficiently answered your questions. Do give more thought to whether you want to use prism or not. AD isolation was left out of Prism largely due to the complexity. You need to be sure you are willing to take on that complexity.
Kent Boogaart
I need to build a "portal" that will load applications, one at a time. When the user is done with the app, its memory should be freed up. That's the reason for unloading the modules. Do you have any other suggestion? Thanks!!!
Gustavo Cavalcanti
Kent, Do you think Prism lacks something I need? I still believe Prism may be a fit. I need to figure out how to make it work regarding the module loading, passing credentials around modules, etc.If you were to build what I need, would you use Prism?Thanks for your help
Gustavo Cavalcanti