原文: wpf中防止界面卡死的写法
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIml2ZuUWYxYmZhR2MiNjY3QGMjFGZlNTOzUWZjJGO2YzM1MWMfdWbp9CXt92Yu4GZjlGbh5SZslmZxl3Lc9CX6MHc0RHaiojIsJye.gif)
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);