/// <summary> /// 重置 /// </summary> public void ReSet() { LstPoint.Clear(); IsCompleted = false; Dist = 0; }
private double DrawValueToGraph(DataSample dts) { var absActualDelegate = Math.Abs(dts.actualDelegate); var dblValueGraph = dts.actualDelegate; dts.result = (int)emMeasureResult.Pass; try { if (MeasureType == emMeasureType.AlarmTest) { dts.result = (int)emMeasureResult.Normal; if (Device.AlarmValue <= Math.Abs(dts.actualDelegate)) { dts.result = (int)emMeasureResult.Alarm; if (measureResult == (int)emMeasureResult.Normal) { measureResult = dts.result; } } // Actual Value > Alarm Value if (absActualDelegate > MainForm.graphDS.UpLimit) { if (!isFirstMax) { maxValue = dts.actualDelegate; isFirstMax = true; } else { if (Math.Abs(dts.actualDelegate) >= Math.Abs(maxValue)) { maxValue = dts.actualDelegate; } } if (IsRenderForm) { MainForm.BeginInvoke((Action)(() => { SetValueLabel(maxValue.ToString(), MainForm.GetlblOverViewValue()); })); } MainForm.BeginInvoke((Action)(() => { MainForm.SetAlarmFlag(Device); MainForm.Blink(Device); })); } if (MainForm.graphDS.maxValue > 0 && absActualDelegate >= MainForm.graphDS.maxValue) { dblValueGraph = (dts.actualDelegate / absActualDelegate) * MainForm.graphDS.maxValue; } } else { MainForm.graphDS.maxPoint = lstMaxValue.Select(i => i.point).ToArray(); } lock (syncObj) { lstSample.Add(dts); } LstPoint.Add((float)dblValueGraph); if (IsRenderForm) { MainForm.BeginInvoke((Action)(() => { MainForm.AddPoint((float)dblValueGraph); })); if ((MainForm.graphDS.Length - MainForm.GetPdeGraph().starting_idx) >= (int)MainForm.GetPdeGraph().endX) { float dx = (MainForm.GetPdeGraph().endX - MainForm.GetPdeGraph().startX); MainForm.GetPdeGraph().SetStartingIdx((int)(MainForm.graphDS.Length - dx - (Math.Abs(MainForm.GetPdeGraph().MoveMouse) > 0 ? MainForm.GetPdeGraph().MoveMouse - 1 : 0))); } MainForm.RefreshGraph(); } //if ((MainForm.graphDS.Length - MainForm.GetPdeGraph().starting_idx) >= (int)MainForm.GetPdeGraph().endX) //{ // float dx = (MainForm.GetPdeGraph().endX - MainForm.GetPdeGraph().startX); // MainForm.GetPdeGraph().SetStartingIdx((int)(MainForm.graphDS.Length - dx - (Math.Abs(MainForm.GetPdeGraph().MoveMouse) > 0 ? MainForm.GetPdeGraph().MoveMouse - 1 : 0))); //} //MainForm.RefreshGraph(); return(dts.actualDelegate); } catch (Exception ex) { return(0); } }