List all loaded modules?

Topics: CAB & Smart Client Software Factory
Feb 15, 2006 at 6:18 AM
originally posted by: spencer_jones

In my application I have loaded a number of modules via a tabworkspace, as with the walkthrough example. I am trying to add two specific bits of functionality to my app:

1) Provide a list of all the loaded modules so that I can display a list of the available modules in the application.

2) How do I pas information between modules and the shell application? For example one of my modules contains a map. I want to display different information based on which "module" the user is interested in. If I get the list of modules (see part 1) I want to get the name of the clicked module and use that to tell my map what data should be shown.

Thanks for any pointers,
Spencer.
Feb 15, 2006 at 7:32 AM
originally posted by: ChrisHolmes

You can get the list of loaded modules via the IModuleLoaderService, which is a default CAB service loaded on startup. Just use the Dependency Injection framework to get it.

The IModuleLoaderService can return an IList of loadedModules, where you can retrieve such information as the Module Name. By default your Module will not be named, however. You'll have to add an assembly attribute to your AssemblyInfo.cs file. In the AssemblyInfo.cs file you need to add a using statement for Microsoft.Practices.CompositeUI and then add a line like this:

assembly: Module("MyModuleName")

That will name your module.

As to your second question: modules are just .dll files. Don't confuse WorkItems and Modules. Modules can contain any number of WorkItems.

For the functionality you require you can publish a Command or Event in your navigation item to tell the Shell to load the proper WorkItem from the proper Module.