0
因此,我创建了一个应用程序,该应用程序将具有加载资源的启动画面,完成时将加载该应用程序的主窗体。在过去,我只是让闪屏拥有线程并保持隐藏状态,但是我打算让我的主表单成为线程所有者,但我在表单之间转换时遇到了问题。我目前的做法是C#应用程序线程
void main(String[] args)
{
ApplicationContext appContext = new ApplicationContext(new SplashScreen());
appContext.ThreadExit += appContext_ThreadExit;
Application.Run(appContext);
}
place
private void appContext_ThreadExit(object sender, EventArgs e)
{
Application.Run(new MainForm());
}
这给我说,你不能启动线程上新的消息循环的错误。那么我该如何正确执行这个过渡?或者我已经通过允许SplashScreen拥有线程来使用最好的方法?
你为什么不使用异步?让启动画面使用async/await加载resurces – Gusman
不会有更多代码有帮助吗?你只是显示有限的代码集 – Seabizkit