繁体   English   中英

我怎么知道我的模块是否都装在棱镜4中?

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

我有一个使用PRISM的WPF桌面应用程序,有12个模块不相互依赖,每次启动shell时,模块都已加载,重点是我想知道哪个模块最后加载所以我可以开始行动。 我怎么能确定这个?

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

扩展erikH的答案(谢谢,顺便说一句),假设您是从默认的UnityBootstrapper派生的,这里是调用通常被重写的方法的顺序:

//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();
}

请注意,这适用于PRISM 4和5

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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