【发布时间】:2016-02-20 15:59:23
【问题描述】:
我正在尝试创建一个使用多个窗口的应用程序。对于初学者,我希望它有一个启动屏幕窗口和一个“主窗口”。我来了这篇文章:http://southworks.com/blog/2010/01/26/creating-a-multi-shell-application-in-prism-v2/ 但是它似乎不适合我的需要。作者同时创建了 2 个窗口,从一开始也同时显示了这两个窗口。我想做的是创建这个启动屏幕窗口(带有一些不错的加载指示器),只有当它的底层逻辑完成它的任务时,我才想显示另一个窗口
protected override DependencyObject CreateShell() {
//return Container.Resolve<MainShell>();
return Container.Resolve<SplashScreenShell>();
}
protected override void InitializeShell() {
base.InitializeShell();
App.Current.MainWindow = (Window)Shell;
App.Current.MainWindow.Show();
}
另一个问题是,当我使用此代码时,我的所有模块(即使是那些仅由 MainShell 使用的模块)都被加载和初始化,这完全不是我想要的。主要是因为 Prism 查找 SplashScreenShell 上不存在的 RegionName(但存在于第二个 shell 上)。
我正在使用 Prism 6.1.0 和 .NET 4.6。
【问题讨论】: