c# 异步更新UI 不阻塞 流畅
Task task = Task.Factory.StartNew(() =>
{
DoLongRunningWork(); // 耗时运算
});
Task UITask= task.ContinueWith(() =>
{
this.TextBlock1.Text = "Complete"; //运算后 赋值
}, TaskScheduler.FromCurrentSynchronizationContext());
btnStop.Invoke(new Action(delegate() { this.btnStop.Enabled = false; }));
btnStart.Invoke(new Action(delegate() { this.btnStart.Enabled = true; }));
本文转自曾祥展博客园博客,原文链接:http://www.cnblogs.com/zengxiangzhan/archive/2012/08/23/2652276.html,如需转载请自行联系原作者