Reference to Loaded Modules for Saving User Settin

Topics: CAB & Smart Client Software Factory
Mar 3, 2006 at 3:55 AM
originally posted by: MarcoPaul

I am using the MySettings class to save some user preferences in my modules, and when the application exits, I need to save my settings. Rather than in each module wiring up to listen to the Application.ApplicationExit event, is there a way in the Shell I can get an instance to all the loaded module init classes? This way, I could define and interface with a SaveSettings() method. Any other ideas?

Thanks
Mar 3, 2006 at 8:43 AM
originally posted by: ChrisHolmes

The IModuleLoaderService is a default CAB service. You can use it to determine all loaded modules. It will help for you to apply a unique name to your modules via an assembly attribute, because then you can check it easier with the ModuleLoaderService.

For example:

In each of your Module's AssemblyInfo.cs files, include the following attribute:

assembly: Module("MyModuleName")

You will need to reference Microsoft.Practices.CompositeUI in the AssemblyInfo.cs file.

The IModuleLoaderService will return an IList of the loaded modules, of which one property will be the Name you provided above, with the assembly attribute.
Mar 3, 2006 at 3:17 PM
originally posted by: MarcoPaul

That's not really what I'm looking for, I need references to the ModuleInit class instances, not the ModuleInfo classes. I'll just use reflection.

Thanks anyway