Exemplo n.º 1
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="inputTaskes"></param>
 public AsyncControlManger(List <ITask> inputTaskes, BaseProcessBarForm useProcessBarForm = null)
 {
     //依附项目
     this.LstAllTask.AddRange(inputTaskes);
     //装配界面
     this.m_useProcessBarForm = useProcessBarForm;
     //执行任务准备
     PrepareTask();
 }
Exemplo n.º 2
0
        /// <summary>
        /// 执行带进度条的并发任务
        /// </summary>
        private void AsyncDoWorkWithProcessBar()
        {
            //若界面为空
            if (null == this.m_useProcessBarForm)
            {
                this.m_useProcessBarForm = new BaseProcessBarForm();
            }
            //为界面装配事务管理器
            this.m_useProcessBarForm.UseAsyncManger = this;

            //制作等待任务
            m_waitDelegate = new TaskDelegate(WaitTask);

            //任务派发
            this.AsyncWork();

            //派发等待任务 结束时自动关闭界面
            m_waitDelegate.BeginInvoke(null, null);

            //将进度条以非模态界面展示
            this.m_useProcessBarForm.ShowDialog();
        }