c# 多线程和异步

有时候需要多线程来运行处理后端和UI的更新。

通常用

 ((Action)delegate()
            {
                if (isBussy) { return; }
                isBussy = true;
                while (true)
                {
                    //code long time task.................

                    Dispatcher.BeginInvoke((Action)(delegate()
            {
                btnStart.Content = DateTime.Now.ToString();
            }
             ));



                    Thread.Sleep(300);
                }

                isBussy = false;

            }).BeginInvoke(null, null);


         

  

原文地址:https://www.cnblogs.com/wgscd/p/9259742.html