我已經創造了新的WPF項目,在主窗口中我做:Dispatcher.Invoke掛起主窗口
public MainWindow()
{
InitializeComponent();
Thread Worker = new Thread(delegate(){
this.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new Action(delegate
{
while (true)
{
System.Windows.MessageBox.Show("asd");
Thread.Sleep(5000);
}
}));
});
Worker.Start();
}
問題之間的那些郵件主窗口掛起。我如何使它異步工作?
線程還應該將IsBackground設置爲true,以便它將與應用程序 – 2013-04-30 11:24:24
一起退出非常感謝。 – Taras 2013-04-30 11:26:40