4

PRISMを使用するWPFデスクトップアプリケーションがあります。相互に依存しないモジュールが12個あります。シェルを起動するたびに、モジュールが読み込まれます。ポイントは、最後にどのモジュールが読み込まれるかを知りたいということです。アクションを開始できます。どうすればこれを判断できますか?

4

2 に答える 2

9

Bootstrapper.InitializeModulesをオーバーライドし、baseを呼び出してから、ACTION!

于 2011-12-07T19:38:27.387 に答える
0

デフォルトのUnityBootstrapperから派生していると仮定して、erikHの回答(ありがとう、ところで)を拡張すると、通常オーバーライドされるメソッドが呼び出される順序は次のとおりです。

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

これはPRISM4および5に適用されることに注意してください

于 2015-05-15T17:40:57.810 に答える