public static void BeforeTestHandler()
 {
     if (ms_tp == TestPhase.Nonstarted)
     {
         SetSyntaxDocumentText(ms_domain.PreparationScript);
         ms_task              = new LocalPreparationVBAScriptTask(ms_domain.DomainGUID, ms_vbaobjects);
         ms_task.AfterScript += new EventHandler(AfterTestHandler);
         ms_tp = TestPhase.Preparation;
         ms_task.Run();
     }
 }
        public static void AfterTestHandler(object sender, EventArgs e)
        {
            BaseVBAScriptTask whichtask = (BaseVBAScriptTask)sender;

            if (whichtask.Status == TaskStatus.Succeed && ms_IsClosed == false)
            {
                switch (ms_tp)
                {
                case TestPhase.Preparation:
                    SetSyntaxDocumentText(ms_domain.ParserScript);
                    ms_task              = new LocalParserVBAScriptTask(ms_domain.DomainGUID, whichtask.TaskChainGUID, ms_vbaobjects);
                    whichtask.VBAObjs    = null;
                    ms_task.AfterScript += new EventHandler(AfterTestHandler);
                    ms_task.Run();
                    ms_tp = TestPhase.Parser;
                    whichtask.Dispose();
                    break;

                case TestPhase.Parser:
                    SetSyntaxDocumentText(ms_domain.StorageScript);
                    ms_task              = new LocalStorageVBAScriptTask(ms_domain.DomainGUID, whichtask.TaskChainGUID, ms_vbaobjects);
                    whichtask.VBAObjs    = null;
                    ms_task.AfterScript += new EventHandler(AfterTestHandler);
                    ms_task.Run();
                    ms_tp = TestPhase.Storage;
                    whichtask.Dispose();
                    break;

                case TestPhase.Storage:
                    MessageBox.Show("测试结束,请检查日志以确定代码是否正确", "通知", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    whichtask.Dispose();
                    ms_task = null;
                    ms_tps  = TestProcessStatus.Ready;
                    RefreshTestToolButtons();
                    break;
                }
            }
            else
            {
                whichtask.Dispose();
                ms_task = null;
                ms_tps  = TestProcessStatus.Ready;
                RefreshTestToolButtons();
            }
        }
        public static void AfterTestHandler(object sender, EventArgs e)
        {
            BaseVBAScriptTask whichtask = (BaseVBAScriptTask)sender;

            if (whichtask.Status == TaskStatus.Succeed && ms_IsClosed == false)
            {
                switch (ms_tp)
                {
                    case TestPhase.Preparation:
                        SetSyntaxDocumentText(ms_domain.ParserScript);
                        ms_task = new LocalParserVBAScriptTask(ms_domain.DomainGUID, whichtask.TaskChainGUID, ms_vbaobjects);
                        whichtask.VBAObjs = null;
                        ms_task.AfterScript += new EventHandler(AfterTestHandler);
                        ms_task.Run();
                        ms_tp = TestPhase.Parser;
                        whichtask.Dispose();
                        break;
                    case TestPhase.Parser:
                        SetSyntaxDocumentText(ms_domain.StorageScript);
                        ms_task = new LocalStorageVBAScriptTask(ms_domain.DomainGUID, whichtask.TaskChainGUID, ms_vbaobjects);
                        whichtask.VBAObjs = null;
                        ms_task.AfterScript += new EventHandler(AfterTestHandler);
                        ms_task.Run();
                        ms_tp = TestPhase.Storage;
                        whichtask.Dispose();
                        break;
                    case TestPhase.Storage:
                        MessageBox.Show("测试结束,请检查日志以确定代码是否正确", "通知", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        whichtask.Dispose();
                        ms_task = null;
                        ms_tps = TestProcessStatus.Ready;
                        RefreshTestToolButtons();                        
                        break;
                }
            }
            else
            {
                whichtask.Dispose();
                ms_task = null;
                ms_tps = TestProcessStatus.Ready;
                RefreshTestToolButtons();              
            }

            
        }
 public static void BeforeTestHandler()
 {
     if (ms_tp == TestPhase.Nonstarted)
     {
         SetSyntaxDocumentText(ms_domain.PreparationScript);
         ms_task = new LocalPreparationVBAScriptTask(ms_domain.DomainGUID, ms_vbaobjects);
         ms_task.AfterScript += new EventHandler(AfterTestHandler);
         ms_tp = TestPhase.Preparation;
         ms_task.Run();
        
     }
 }