[英]How to change the main window in compact framework?
Is there some equivalent of wpf's Application.MainWindow in compact framework? 在紧凑的框架中,有什么WPF的Application.MainWindow等效项? The issue i have is that i run the SplashScreen, it does some work, and i need to close it and open the login page.
我的问题是我运行了SplashScreen,它做了一些工作,需要关闭它并打开登录页面。 I try to just close the form and open another one, but it closes the entire application, as the SplashScreen is the one I pass to the Application.Run() method
我试图关闭窗体并打开另一个窗体,但是它关闭了整个应用程序,因为SplashScreen是我传递给Application.Run()方法的窗体。
I don't want to hide the form, because it causes problems when I want to hide my entire application and call another application from my code(the splash screen seems to be still there even though i do call the hide method), so i need to close the splash screen and open the login screen 我不想隐藏表单,因为当我想隐藏我的整个应用程序并从我的代码中调用另一个应用程序时,它会引起问题(即使我确实调用了hide方法,启动画面似乎仍然存在),所以我需要关闭启动画面并打开登录画面
You have a few options. 您有几种选择。
Application.Run
. Application.Run
。 Send in your main form, then have it create the instance of the splash and handle showing and hiding it. Application.Run
: Application.Run
: ie 即
Application.Run(new SplashScreen());
Application.Run(new MainForm());
Set: App.xaml (property) -> Build Action -> "Page" 设置: App.xaml(属性)->构建操作->“页面”
Set in App.xaml.cs Main() : 在App.xaml.cs Main()中设置 :
[System.STAThreadAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public static void Main()
{
SplashScreen ss = new SplashScreen();
ss.showDialog();
App app = new App();
app.InitializeComponent();
app.Run();
}
Set App.xaml: 设置App.xaml:
<Application
//something
StartupUri="MainWindow.xaml">
//something
</Application>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.