天天看點

wpf中防止界面卡死的寫法

原文: wpf中防止界面卡死的寫法

wpf中防止界面卡死的寫法
wpf中防止界面卡死的寫法
View Code

this.button1.Content = "正在計算";

Action action = new Action(() => {

System.Threading.Thread.Sleep(3000);

this.Dispatcher.BeginInvoke(new Action(() =>

{

this.button1.Content = "計算完畢";

}), System.Windows.Threading.DispatcherPriority.SystemIdle, null);

});

action.BeginInvoke(null,null);