Jun 22, 2010 at 6:20 PM
Edited Jun 22, 2010 at 6:22 PM
In order to make sure that a module has been initialized, you could check the
State property inside the ModuleInfo instance corresponding to your module. You can access a collection of ModuleInfo in the
Modules property of IModuleCatalog.
The code for that would look like this:
public ToolbarModule(IModuleCatalog catalog)
ModuleState MyModuleState= catalog.Modules.Where(m => m.ModuleName == "MyModule").FirstOrDefault().State;
Assuming that catalog is a reference to your IModuleCatalog implementation, which you can access through
dependency injection (in this sample code i've used
Constructor Injection with
However, please note that if you are publishing an event using Event Aggregation to communicate between modules, you shouldn’t have problems if you have no subscribers (that
is, if no module is listening to that event).
On the other hand, if you want a module to be loaded strictly before another one, you could specify module dependencies, as explained on
this article from the Prism documentation.
I hope you find this helpful.
Guido Leandro Maliandi