Exemplo n.º 1
0
Arquivo: MainForm.cs Projeto: zzyn/poc
        /// <summary>
        /// 匹配 任务状态处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMatchTaskStatusChanged(object sender, TaskEventArgs e)
        {
            MatchDataEntity entity = e.Result as MatchDataEntity;

            switch (e.Status)
            {
            case TaskStatus.Running:

                break;

            case TaskStatus.CancelPending:

                break;

            case TaskStatus.Stopped:

                break;

            case TaskStatus.AbortPending:

                break;

            case TaskStatus.Aborted:

                this.btnStartMatch.Enabled   = true;
                this.btnCancleMatch.Enabled  = false;
                this.tsbtnDiffExport.Enabled = true;
                break;

            case TaskStatus.ThrowErrorStoped:

                break;
            }
        }
Exemplo n.º 2
0
Arquivo: MainForm.cs Projeto: zzyn/poc
        /// <summary>
        /// 匹配 任务进度处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMatchTaskProcessChanged(object sender, TaskEventArgs e)
        {
            //不在UI线程上,异步调用
            if (InvokeRequired)
            {
                TaskEventHandler TPChanged = new TaskEventHandler(OnMatchTaskProcessChanged);

                //this.BeginInvoke(TPChanged, new object[] { sender, e });
                this.Invoke(TPChanged, new object[] { sender, e });
            }
            //在UI线程上,更新控件状态
            else
            {
                MatchDataEntity entity = e.Result as MatchDataEntity;

                this.tspbMatch.Maximum = entity.TotalCount;
                this.tspbMatch.Value   = e.Progress;


                this.tslMatch.Text = string.Format("{0}/{1}", this.tspbMatch.Value, this.tspbMatch.Maximum);

                //DataTable dt = entity.DataTable;
                if (entity.MatchRow != null)
                {
                    this.MatchTable.ImportRow(entity.MatchRow);
                }



                //Application.DoEvents();
            }
        }