加载与隐藏显示

Task.Run(() =>
            {
                try
                {
                    this.LoadingShow();

                    #region 非UI业务

                    #endregion

                    #region UI业务
                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        //UI控件变化
                    }));
                    #endregion

                    #region 同步任务
                    var task = new Task(() =>
                    {

                        //do something
                    });
                    task.Start();
                    task.Wait();//同步
                    #endregion

                    this.LoadingHide();
                }
                catch (Exception ex)
                {
                    this.BoxErrorMsg(ex.Message);
                    this.LoadingHide();
                }
            });

  

posted @ 2020-08-14 14:42  jasonlai2016  阅读(137)  评论(0编辑  收藏  举报