Exemple #1
0
        private void StartConsumer(TestConfig[] testConfigs, Dictionary <string, object> chartDic,
                                   AChart _aChart, FormUi formUi, Dictionary <string, plotData> spec, string saveTxtPath)
        {
            ConsumerParams cpParams = new ConsumerParams();

            cpParams.ChartDic    = chartDic;
            cpParams.AChart      = _aChart;
            cpParams.TestConfigs = testConfigs;
            cpParams.FormUi      = formUi;
            cpParams.Spec        = spec;
            cpParams.SaveTxtPath = saveTxtPath + "\\" + "TXT" + "\\1";
            if (Directory.Exists(cpParams.SaveTxtPath))
            {
                Directory.Delete(cpParams.SaveTxtPath, true);
            }
            Directory.CreateDirectory(cpParams.SaveTxtPath);


            Task taskSnpConsumer = Task.Factory.StartNew(SnpConsumer, cpParams);

            taskSnpConsumer.Wait();


            Task taskTxtConsumer = Task.Factory.StartNew(DataConsumer, cpParams);

            taskTxtConsumer.Wait();
            formUi.ProgressDisplay(300, false);
        }
Exemple #2
0
        public void DoTest(TestConfig[] testConfigs, Dictionary <string, object> chartDic,
                           AChart aChart, FormUi formUi, Dictionary <string, plotData> spec, Dictionary <string, float[]> keyPoint, Savepath savepath, bool report)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            TestInitia(formUi, chartDic, aChart);
            StartProducer(testConfigs, formUi, savepath.SnpFilePath);
            Thread.Sleep(2000);
            StartConsumer(testConfigs, chartDic, aChart, formUi, spec, savepath.TxtFilePath);

            formUi.SetKeyPointList(GetKeyValue(keyPoint));
            SetTestResult(formUi.AddStatus, formUi.SetResult, _testResult);


            //SetInformation(savepath.Sn);
            //CopySpec(savepath);
            //TestUtil.SaveResult_Sample(savepath.XmlPath, _itemTestResult, _information);
            SaveSummary(savepath, _itemTestResult, _information);
            if (report)
            {
                GenerateReport(savepath);
            }
            else
            {
                formUi.AddStatus(LanguageHelper.GetMsgText("报告生成设定为false,取消生成报告"));
            }

            stopwatch.Stop();                      //  停止监视
            TimeSpan timespan = stopwatch.Elapsed; //  获取当前实例测量得出的总时间

            formUi.AddStatus(LanguageHelper.GetMsgText("测试结束"));
            formUi.AddStatus(LanguageHelper.GetMsgText("测试用时") + String.Format(":{0:F}S", timespan.TotalSeconds));
        }
Exemple #3
0
        /// <summary>
        /// 控制仪器生成SNP文件
        /// </summary>
        /// <param name="testConfigs">测试参数配置</param>
        /// <param name="formUi">回调操作</param>
        /// <param name="testDataPath">SNP保存路径</param>
        private void StartProducer(TestConfig[] testConfigs, FormUi formUi, string testDataPath)
        {
            ProducerParams producerParams = new ProducerParams();

            producerParams.TestConfigs  = testConfigs;
            producerParams.FormUi       = formUi;
            producerParams.TestDataPath = testDataPath;
            //Thread t = new Thread(new ParameterizedThreadStart(SnpProducer));
            //t.Start(producerParams);
            Task.Factory.StartNew(SnpProducer, producerParams);
        }
Exemple #4
0
 /// <summary>
 /// 测试数据,状态初始化
 /// </summary>
 /// <param name="formUi"></param>
 /// <param name="chartDic"></param>
 /// <param name="aChart"></param>
 private void TestInitia(FormUi formUi, Dictionary <string, object> chartDic,
                         AChart aChart)
 {
     formUi.ProgressDisplay(0, false);
     formUi.AddStatus(LanguageHelper.GetMsgText("测试开始"));
     formUi.SetResult("TEST");
     _testData.Clear();
     _testResult.Clear();
     _specLine.Clear();
     chartDic.ForEach(t =>
     {
         formUi.AddStatus(LanguageHelper.GetMsgText("清除图形") + ":" + t.Key);
         aChart.ChartClear(t.Value);
     });
 }
Exemple #5
0
 public void DoTestManual(TestConfig[] testConfigs, Dictionary <string, object> chartDic,
                          AChart aChart, FormUi formUi, Dictionary <string, plotData> spec, Dictionary <string, float[]> keyPoint, Savepath savePath)
 {
 }
Exemple #6
0
 public void DoTestManualStart(FormUi formUi, Dictionary <string, object> chartDic, AChart aChart)
 {
     TestInitia(formUi, chartDic, aChart);
 }