0
点赞
收藏
分享

微信扫一扫

WPF在新线程中打开窗体

打开窗体

Window win;
Thread t=new Thread(()=>
{
win=new Window();
win.Show();
System.Windows.Threading.Dispatcher.Run();
});
t.IsBackground=true;
t.SetApartmentState(ApartmentState.STA);
t.start();

Thread t2=new Thread(()=>
{
Thread.Sleep(600);
});
t2.IsBackground=true;
t2.start();
t2.Join();

关闭

System.Windows.Threading.Dispatcher.ExitAllFrames();

备忘

举报

相关推荐

0 条评论