简体   繁体   中英

How could I know if all my modules are loaded in prism 4?

I have a WPF Desktop application using PRISM, there are 12 modules which do not depend on each other , every time i start the shell, modules are been loaded , the point is that I would like to know which module loads at the last so I could start an action. How could I determine this ?

覆盖Bootstrapper.InitializeModules,调用base,然后执行ACTION!

Expanding on erikH's answer (thank you, btw), assuming that you are deriving from the default UnityBootstrapper, here is the order in which the typically overridden methods are called:

//0
public override void Run(bool runWithDefaultConfiguration)
{
    base.Run(runWithDefaultConfiguration);
    //this is our last opportunity to hook into the PRISM bootstrapping sequence; at this point every very other base-overridden 
    //method has been executed
}

//1
protected override void ConfigureModuleCatalog()
{
    base.ConfigureModuleCatalog();
    ModuleCatalog moduleCatalog = (ModuleCatalog)this.ModuleCatalog;
    //add modules...
}

//2
protected override void ConfigureContainer() 
{
    base.ConfigureContainer();
    //register everything with the container...
}

//3
protected override DependencyObject CreateShell()
{
    return Container.Resolve<ShellView>();      //resolve your root component
}

//4
protected override void InitializeShell()
{
    base.InitializeShell();
    App.Current.MainWindow = (Window)Shell;
    App.Current.MainWindow.Show();
}

//5
protected override void InitializeModules()
{
    base.InitializeModules();
}

Note that this applies to PRISM 4 and 5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM