Notification That All Modules Are Loaded

Topics: Prism v2 - WPF 3.5
Aug 4, 2009 at 6:52 PM

Hello All,

Is there any way that I can know when the Module Manager has finished loading all modules? There doesn't seem to be any support for this type of notification.

Thanks,

Dave

 

Aug 4, 2009 at 9:12 PM

Why not just raise your own even after InitializeModules in your Bootstrapper?

public override void InitializeModules()
{
     base.InitializeModules();
     //Raise here. 
}

 

 

Aug 4, 2009 at 9:45 PM
Edited Aug 4, 2009 at 9:48 PM

I agree - here is an example using a new thread

public void ModulesInitialized()
{
    // Raise process event (handled in PresenterBase)
    Container.Resolve<IEventAggregator>()
        .GetEvent<ProcessEvent>().Publish(new ProcessEventArgs
        {
            ProcessType = ProcessType.OnModulesInitialized
        });
}

protected override void InitializeModules()
{
    base.InitializeModules();

    // Run ModuleInitialized() on separate thread
    Dispatcher.CurrentDispatcher.BeginInvoke(
        System.Windows.Threading.DispatcherPriority.SystemIdle,
        new ModulesInitializedDelegate(ModulesInitialized));
}