How to know that a module is already loaded

Topics: Prism v2 - Silverlight 3
Sep 25, 2009 at 9:53 PM

Hi everyboy

I work on a SL3 project with prism v2. In my application i have some modules to load on demande. These modules

are loaded when the user click on a button. But as the user can click more than one on this button i would like to check

if the module to load is already loaded.

Any help will be appreciated.


Sep 25, 2009 at 10:40 PM


You can use code like this to check if a module has been loaded (using ModuleState.Initialized means the Initialize method has been called. Another state might fit your situation better depending what “already loaded” means):

ModuleInfo info = catalog.Modules.First(m => m.ModuleName == "MyModule");
if (info.State == ModuleState.Initialized)      
    //your code here

Take into account, that calling the Load method for an already loaded module does not do anything.

Please let me know if this helps.

Damian Schenkelman