示例#1
0
        /// <summary>
        /// 启动任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("开始测试前,请保证测试设备已经连接成功。");
            if (this.TestCase == null)
            {
                MessageBox.Show("在开始前请先选择任务!");
                return;
            }
            string     taskId      = this.CurrentTask.Id;
            List <Log> taskLogList = log.SelectBy("TaskId", taskId);

            if (taskLogList.Count > 0)
            {
                if (MessageBox.Show("此任务存在测试数据,是否删除测试数据重新测试?", "确认", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
                else
                {
                    foreach (var inst in taskLogList)
                    {
                        log.Delete(inst.Id);
                    }
                }
            }

            this.core.Init(this.TestCase);
            Thread t2 = new Thread(() => ChangeStatusView());

            t2.IsBackground = true;
            t2.Start();

            Thread t1 = new Thread(() => ThreadStart());

            t1.Start();

            ShowMessage += this.SetToUI;
            Thread t = new Thread(() => this.ShowLog());

            t.IsBackground = true;
            t.Start();
        }