public bool ProcessTestStep() { stopWatch.Start(); Thread.Sleep(1000); stopWatch.Stop(); long time = stopWatch.ElapsedMilliseconds; Random rand = new Random(); foreach (TestStepEvents eventId in Enum.GetValues(typeof(TestStepEvents))) { bool result = true; string trueValue = rand.Next(1024).ToString(); ProcessTestStepEventArgs args = new ProcessTestStepEventArgs { TestStepEventId = eventId, ElapsedTime = stopWatch.ElapsedMilliseconds, TestResult = result, Reason = (result) ? "OK" : "Failure", TrueValue = trueValue }; ProcessTestStepEvent(args); } return(true); }
protected virtual void ProcessTestStepEvent(ProcessTestStepEventArgs e) { EventHandler <ProcessTestStepEventArgs> handler = ProcessTestStepHandler; if (handler != null) { handler(this, e); } }
private void ProcessTestStep(object sender, ProcessTestStepEventArgs e) { TestStepEvents testStepEventId = e.TestStepEventId; RowData list = testDataRowsList[(int)testStepEventId]; list.TrueValue = e.TrueValue; list.Spend = e.ElapsedTime / 1000; if (!e.TestResult) { list.Result = "FAIL"; list.Comments = e.Reason; } object[] row = { list.Temperature, list.Voltage, list.TestItem, list.Target, list.Max, list.Min, list.TrueValue, list.DA_AD_C, list.Result, list.Spend, list.Comments }; dataGridViewTestResult.Rows.Add(row); WriteLogs(string.Format("{0}:{1}", System.Reflection.MethodBase.GetCurrentMethod().Name, testStepEventId)); AllElapsedTime += e.ElapsedTime; if (e.TestResult) { if (TestStepEvents.EVENT_DMM_BIAS == testStepEventId) { ProcessTestStepClean(true); } } else { ProcessTestStepClean(false); } }