Exemplo n.º 1
0
        public void ExcuteMultiTask(ref List <CheckTask> availableTasks)
        {
            if (m_MultiTask == null)
            {
                return;
            }

            List <CheckTask> tempTasks = null;

            System.Threading.ThreadStart threadStart = delegate
            {
                m_MultiTask.CheckingTaskChanged += new TaskCheckEventsHandler(m_MultiTask_CheckingTaskChanged);
                m_MultiTask.CreatingTaskChanged += new TaskCreateEventsHandler(m_MultiTask_CreatingTaskChanged);
                m_MultiTask.TaskChecked         += new TaskCheckEventsHandler(m_MultiTask_TaskChecked);
                m_MultiTask.TaskCreated         += new TaskCreateEventsHandler(m_MultiTask_TaskCreated);

                //AdaptCheckerEvents(m_MultiTask.TaskChecker);
                m_MultiTask.Excute(ref tempTasks);
                // availableTasks = tempTasks;


                ThreadStart invokeFuction = delegate
                {
                    lblOperateType.Text = "所有任务执行完成";
                };
                this.Invoke(invokeFuction);
            };

            System.Threading.Thread thread = new System.Threading.Thread(threadStart);
            thread.Start();

            this.ShowDialog();

            availableTasks = tempTasks;
        }
Exemplo n.º 2
0
        private void wizardControl1_FinishClick(object sender, CancelEventArgs e)
        {
            DataTable tTasks = GridCheckSetting.DataSource as DataTable;

            if (tTasks.Rows.Count > 0)
            {
                this.Hide();

                MultiTask multiTask = new MultiTask();
                for (int i = 0; i < tTasks.Rows.Count; i++)
                {
                    multiTask.AddTask(this.GetTaskFromDataRow(tTasks.Rows[i]));
                }

                //FrmMultiTaskCheck frmCheck = new FrmMultiTaskCheck(multiTask);
                //frmCheck.ExcuteMultiTask(ref m_AvailableTasks);

                multiTask.CreatingTaskChanged += new TaskCreateEventsHandler(multiTask_CreatingTaskChanged);
                multiTask.TaskCreated         += new TaskCreateEventsHandler(multiTask_TaskCreated);
                multiTask.CheckingTaskChanged += new TaskCheckEventsHandler(multiTask_CheckingTaskChanged);
                multiTask.TaskChecked         += new TaskCheckEventsHandler(multiTask_TaskChecked);
                //m_FrmCheck.AdaptCheckerEvents(multiTask.TaskChecker);

                //System.Threading.ThreadStart threadStart = delegate
                //{
                bool isSucceed = multiTask.Excute(ref m_AvailableTasks);
                if (isSucceed)
                {
                    XtraMessageBox.Show(multiTask.PromptMessage);
                }
                else
                {
                    XtraMessageBox.Show("批量任务过程中出现错误,创建失败");
                }

                //};
                //System.Threading.Thread thread = new System.Threading.Thread(threadStart);
                //thread.Start();
            }
        }