【发布时间】:2011-08-28 02:23:27
【问题描述】:
我有一个主 WPF 应用程序和其他模块,我正在使用 PRISM 来托管在我的 Shell 中定义的不同区域中的模块视图。这对我来说很好。 我现在需要将我的主应用程序设置为类库并从另一个窗口应用程序调用它。 这个新的 Window 应用程序有一个 Main 函数,代码如下。
[System.STAThreadAttribute()]
public static void Main()
{
Application app = new Application();
IStartupUI start = new StartupUI();
start.StartUserInterface();
app.Run();
}
start.StartUserInterface 基本上是调用dll中的函数,代码如下
ABCBootStrapper bootstrapper = new ABCBootStrapper ();
bootstrapper.Run();
当 Dll 本身是主应用程序时,之前在 OnStartup 中调用了同一段代码。
现在有了这个更改,Shell 不会显示任何视图。在调试时,我发现 RegionManager 无法识别 Shell 中定义的任何区域。基本上注册到 RegionManager 的区域数量为 0。 在 shell 中定义的所有区域都是 ContentControl。
【问题讨论】: