我想设置一个 WPF 应用程序。但是,我没有使用应用程序的入口点到 App.xaml 本身,而是使用项目。
第一个项目是 Windows 应用程序,并具有正常的 Main 功能。我还有一个额外的项目(WPF 控件库),它有 App.xaml、窗口、控件和它需要的所有东西。
主要方法像这样启动应用程序:
[STAThread] static void Main() { Application.Run(); }
其中 Application 是库中的一个类:
public static class Application { public void Run() { App app = new App(); app.Run(); } }
app 是我的 App.xaml。App.xaml 定义了一个启动 uri MainWindow.xaml
。但是,如果我运行应用程序,则该窗口永远不会显示,而是应用程序本身运行。
我无法在第一个程序集中设置 App.xaml,因为我必须支持多个窗口框架(WPF、Gtk# 等)。任何建议如何管理这种情况?