private void OnTimer(object source, System.Timers.ElapsedEventArgs e)
        {
            GetSmokePrepareRealTimeDataAckParams ackParams = new GetSmokePrepareRealTimeDataAckParams();

            if (_dynoCmd.GetSmokePrepareRealTimeDataCmd(true, false, ref ackParams, out string errMsg) && ackParams != null)
            {
                if (_timer != null && _timer.Enabled)
                {
                    try {
                        Invoke((EventHandler) delegate {
                            if (ackParams.msg != null && ackParams.msg.Length > 0)
                            {
                                lblMsg.Text = ackParams.msg;
                            }
                            if (ackParams.step >= 0 && ackParams.step < 5)
                            {
                                lblStep.Text = _strStep[ackParams.step];
                            }
                            else
                            {
                                lblStep.Text = "--";
                            }
                            lblNs.Text  = ackParams.Ns;
                            lblK.Text   = ackParams.K;
                            lblCO2.Text = ackParams.CO2.ToString("F");
                            if (lblZero.Text != "完成")
                            {
                                lblZero.Text = ackParams.Zero ?? "--";
                            }
                            if (lblDistancepointCheck.Text != "成功")
                            {
                                lblDistancepointCheck.Text = ackParams.DistancepointCheck ? "成功" : "失败";
                            }
                            if (ackParams.step >= 4 || _dicStops[this])
                            {
                                _timer.Enabled    = false;
                                bool bResult      = lblZero.Text == "完成";
                                bResult           = bResult && lblDistancepointCheck.Text == "成功";
                                _dicResults[this] = bResult;
                                lblResult.Text    = _dicResults[this] ? "成功" : "失败";
                                ackParams         = new GetSmokePrepareRealTimeDataAckParams();
                                _dynoCmd.GetSmokePrepareRealTimeDataCmd(false, true, ref ackParams, out errMsg);
                                SelfcheckDoneEventArgs args = new SelfcheckDoneEventArgs {
                                    Result = _dicResults[this]
                                };
                                SelfcheckDone?.Invoke(this, args);
                            }
                        });
                    } catch (ObjectDisposedException) {
                        // 关闭窗口后仍有一定几率会进入主UI线程,此时访问界面元素会引发此异常,直接忽略即可
                    }
                }
            }
        }
Esempio n. 2
0
        private void OnTimer(object source, System.Timers.ElapsedEventArgs e)
        {
            GetTachometerPrepareRealTimeDataAckParams ackParams = new GetTachometerPrepareRealTimeDataAckParams();

            if (_dynoCmd.GetTachometerPrepareRealTimeDataCmd(true, false, ref ackParams, out string errMsg) && ackParams != null)
            {
                if (_timer != null && _timer.Enabled)
                {
                    try {
                        Invoke((EventHandler) delegate {
                            lblGasRPMLow.Text     = ackParams.QYRPMLow.ToString();
                            lblGasRPMHigh.Text    = ackParams.QYRPMHigt.ToString();
                            lblGasRPM.Text        = ackParams.RPM.ToString();
                            lblDieselRPMLow.Text  = ackParams.CYRPMLow.ToString();
                            lblDieselRPMHigh.Text = ackParams.CYRPMHigt.ToString();
                            lblDieselRPM.Text     = ackParams.CYRPM.ToString();
                            lblOBDRPM.Text        = ackParams.OBDRPM.ToString();
                            bool RPMOK            = (ackParams.RPM >= ackParams.QYRPMLow) && (ackParams.RPM <= ackParams.QYRPMHigt);
                            RPMOK      = RPMOK || ((ackParams.CYRPM >= ackParams.CYRPMLow) && (ackParams.CYRPM <= ackParams.CYRPMHigt));
                            bool OBDOK = Math.Abs(ackParams.OBDRPM - ackParams.RPM) <= RPM_Tolerance;
                            OBDOK      = OBDOK || Math.Abs(ackParams.OBDRPM - ackParams.CYRPM) <= RPM_Tolerance;
                            OBDOK      = OBDOK && ackParams.OBDRPM > 0;
                            if ((RPMOK || OBDOK) || _dicStops[this])
                            {
                                _timer.Enabled    = false;
                                _dicResults[this] = true;
                                ackParams         = new GetTachometerPrepareRealTimeDataAckParams();
                                _dynoCmd.GetTachometerPrepareRealTimeDataCmd(false, true, ref ackParams, out errMsg);
                                SelfcheckDoneEventArgs args = new SelfcheckDoneEventArgs {
                                    Result = _dicResults[this]
                                };
                                SelfcheckDone?.Invoke(this, args);
                            }
                        });
                    } catch (ObjectDisposedException) {
                        // 关闭窗口后仍有一定几率会进入主UI线程,此时访问界面元素会引发此异常,直接忽略即可
                    }
                }
            }
        }
Esempio n. 3
0
        private void OnTimer(object source, System.Timers.ElapsedEventArgs e)
        {
            GetOilTempPrepareRealTimeDataAckParams ackParams = new GetOilTempPrepareRealTimeDataAckParams();

            if (_dynoCmd.GetOilTempPrepareRealTimeDataCmd(true, false, ref ackParams, out string errMsg) && ackParams != null)
            {
                if (_timer != null && _timer.Enabled)
                {
                    try {
                        Invoke((EventHandler) delegate {
                            lblOilTemp.Text    = ackParams.oilTemp.ToString("F");
                            lblOilTempCY.Text  = ackParams.oilTempCY.ToString("F");
                            lblOilTempOBD.Text = ackParams.oilTempOBD.ToString("F");
                            lblLQYTempOBD.Text = ackParams.LQYTempOBD.ToString("F");
                            bool tempOK        = ackParams.oilTemp > 0;
                            tempOK             = tempOK || ackParams.oilTempCY > 0;
                            tempOK             = tempOK || ackParams.oilTempOBD > 0;
                            tempOK             = tempOK || ackParams.LQYTempOBD > 0;
                            if (tempOK || _dicStops[this])
                            {
                                if (++_counter >= OK_COUNTER || _dicStops[this])
                                {
                                    _timer.Enabled    = false;
                                    _dicResults[this] = true;
                                    ackParams         = new GetOilTempPrepareRealTimeDataAckParams();
                                    _dynoCmd.GetOilTempPrepareRealTimeDataCmd(false, true, ref ackParams, out errMsg);
                                    SelfcheckDoneEventArgs args = new SelfcheckDoneEventArgs {
                                        Result = _dicResults[this]
                                    };
                                    SelfcheckDone?.Invoke(this, args);
                                }
                            }
                        });
                    } catch (ObjectDisposedException) {
                        // 关闭窗口后仍有一定几率会进入主UI线程,此时访问界面元素会引发此异常,直接忽略即可
                    }
                }
            }
        }
Esempio n. 4
0
        private void OnTimer(object source, System.Timers.ElapsedEventArgs e)
        {
            GetWeatherPrepareRealTimeDataAckParams ackParams = new GetWeatherPrepareRealTimeDataAckParams();

            if (_dynoCmd.GetWeatherPrepareRealTimeDataCmd(true, false, ref ackParams, out string errMsg) && ackParams != null)
            {
                if (_timer != null && _timer.Enabled)
                {
                    try {
                        Invoke((EventHandler) delegate {
                            lblTemperature.Text = ackParams.temperature.ToString("F");
                            lblHumidity.Text    = ackParams.humidity.ToString("F");
                            lblPressure.Text    = ackParams.amibientPressure.ToString("F");
                            if ((/*ackParams.temperature > 0 && */ ackParams.humidity > 0 && ackParams.amibientPressure > 0) || _dicStops[this])
                            {
                                if (++_counter >= OK_COUNTER || _dicStops[this])
                                {
                                    _envData.Temperature = ackParams.temperature;
                                    _envData.Humidity    = ackParams.humidity;
                                    _envData.Pressure    = ackParams.amibientPressure;
                                    _timer.Enabled       = false;
                                    _dicResults[this]    = true;
                                    ackParams            = new GetWeatherPrepareRealTimeDataAckParams();
                                    _dynoCmd.GetWeatherPrepareRealTimeDataCmd(false, true, ref ackParams, out errMsg);
                                    SelfcheckDoneEventArgs args = new SelfcheckDoneEventArgs {
                                        Result = _dicResults[this]
                                    };
                                    SelfcheckDone?.Invoke(this, args);
                                }
                            }
                        });
                    } catch (ObjectDisposedException) {
                        // 关闭窗口后仍有一定几率会进入主UI线程,此时访问界面元素会引发此异常,直接忽略即可
                    }
                }
            }
        }
        private void OnTimer(object source, System.Timers.ElapsedEventArgs e)
        {
            GetFlowmeterPrepareRealTimeDataAckParams ackParams = new GetFlowmeterPrepareRealTimeDataAckParams();

            if (_dynoCmd.GetFlowmeterPrepareRealTimeDataCmd(true, false, ref ackParams, out string errMsg) && ackParams != null)
            {
                if (_timer != null && _timer.Enabled)
                {
                    try {
                        Invoke((EventHandler) delegate {
                            if (ackParams.msg != null && ackParams.msg.Length > 0)
                            {
                                lblMsg.Text = ackParams.msg + ", 剩余" + ackParams.time + "秒";
                            }
                            else
                            {
                                lblMsg.Text = "流量计自检, 剩余" + ackParams.time + "秒";
                            }
                            if (ackParams.step >= 0 && ackParams.step < 5)
                            {
                                lblStep.Text = _strStep[ackParams.step];
                            }
                            else
                            {
                                lblStep.Text = "--";
                            }
                            lblFlow.Text     = ackParams.flow;
                            lblO2.Text       = ackParams.O2;
                            lblRestTime.Text = ackParams.time;
                            if (lblZero.Text != "合格")
                            {
                                lblZero.Text = ackParams.ZeroResult ?? "--";
                            }
                            if (lblFlowCheck.Text != "合格")
                            {
                                lblFlowCheck.Text = ackParams.FlowCheckResult ?? "--";
                            }
                            if (lblO2SpanCheck.Text != "合格")
                            {
                                lblO2SpanCheck.Text = ackParams.O2SpanCheckResult ?? "--";
                            }
                            if (lblResult.Text != "合格")
                            {
                                lblResult.Text = ackParams.FlowmeterPrepareResult ?? "--";
                            }
                            if ((ackParams.step >= 4) || _dicStops[this])
                            {
                                _timer.Enabled = false;
                                bool bResult   = lblZero.Text == "合格";
                                //bResult = bResult && lblFlowCheck.Text == "合格";
                                //bResult = bResult && lblO2SpanCheck.Text == "合格";
                                _dicResults[this] = bResult;
                                //lblResult.Text = _dicResults[this] ? "合格" : "不合格";
                                ackParams = new GetFlowmeterPrepareRealTimeDataAckParams();
                                _dynoCmd.GetFlowmeterPrepareRealTimeDataCmd(false, true, ref ackParams, out errMsg);
                                SelfcheckDoneEventArgs args = new SelfcheckDoneEventArgs {
                                    Result = _dicResults[this]
                                };
                                SelfcheckDone?.Invoke(this, args);
                            }
                        });
                    } catch (ObjectDisposedException) {
                        // 关闭窗口后仍有一定几率会进入主UI线程,此时访问界面元素会引发此异常,直接忽略即可
                    }
                }
            }
        }
        private void OnTimer(object source, System.Timers.ElapsedEventArgs e)
        {
            GetGasboxPrepareRealTimeDataAckParams ackParams = new GetGasboxPrepareRealTimeDataAckParams();

            if (_dynoCmd.GetGasboxPrepareRealTimeDataCmd(true, false, ref ackParams, out string errMsg) && ackParams != null)
            {
                if (_timer != null && _timer.Enabled)
                {
                    try {
                        Invoke((EventHandler) delegate {
                            if (ackParams.msg != null && ackParams.msg.Length > 0)
                            {
                                lblMsg.Text = ackParams.msg + ", 剩余" + ackParams.NowOperationTimeRemaining + "秒";
                            }
                            else
                            {
                                lblMsg.Text = "尾气分析仪自检, 剩余" + ackParams.NowOperationTimeRemaining + "秒";
                            }
                            lblAmibientHC.Text      = ackParams.AmibientHC;
                            lblAmibientCO.Text      = ackParams.AmibientCO;
                            lblAmibientCO2.Text     = ackParams.AmibientCO2;
                            lblAmibientNO.Text      = ackParams.AmibientNO;
                            lblAmibientO2.Text      = ackParams.AmibientO2;
                            lblBackHC.Text          = ackParams.BackHC;
                            lblBackCO.Text          = ackParams.BackCO;
                            lblBackCO2.Text         = ackParams.BackCO2;
                            lblBackNO.Text          = ackParams.BackNO;
                            lblBackO2.Text          = ackParams.BackO2;
                            lblStep.Text            = ackParams.step.ToString();
                            lblResidualHC.Text      = ackParams.ResidualHC ?? "--";
                            lblCO2COGas.Text        = ackParams.QYSumCO2COLimit.ToString("F");
                            lblCO2CODiesel.Text     = ackParams.CYSumCO2COLimit.ToString("F");
                            lblCO2CO.Text           = ackParams.SumCO2CO.ToString("F");
                            lblZero.Text            = ackParams.Zero ? "成功" : "失败";
                            lblAmibientCheck.Text   = ackParams.AmibientCheck ? "成功" : "失败";
                            lblBackGroundCheck.Text = ackParams.BackGroundCheck ? "成功" : "失败";
                            lblHCResidualCheck.Text = ackParams.HCResidualCheck ? "成功" : "失败";
                            lblO2SpanCheck.Text     = ackParams.O2SpanCheck ? "成功" : "失败";
                            lblLowFlowCheck.Text    = ackParams.TestGasInLowFlowCheck ? "成功" : "失败";
                            if (ackParams.step >= 8 || _dicStops[this])
                            {
                                _timer.Enabled = false;
                                bool bResult   = lblZero.Text == "成功";
                                bResult        = bResult && lblAmibientCheck.Text == "成功";
                                bResult        = bResult && lblBackGroundCheck.Text == "成功";
                                bResult        = bResult && lblHCResidualCheck.Text == "成功";
                                bResult        = bResult && lblO2SpanCheck.Text == "成功";
                                bResult        = bResult && lblLowFlowCheck.Text == "成功";
                                if (_bDiesel)
                                {
                                    //bResult = bResult && ackParams.SumCO2CO > ackParams.CYSumCO2COLimit;
                                    bResult = ackParams.SumCO2CO > ackParams.CYSumCO2COLimit;
                                }
                                else
                                {
                                    //bResult = bResult && ackParams.SumCO2CO > ackParams.QYSumCO2COLimit;
                                    bResult = ackParams.SumCO2CO > ackParams.QYSumCO2COLimit;
                                }
                                _dicResults[this] = bResult;
                                lblResult.Text    = _dicResults[this] ? "成功" : "失败";
                                ackParams         = new GetGasboxPrepareRealTimeDataAckParams();
                                _dynoCmd.GetGasboxPrepareRealTimeDataCmd(false, true, ref ackParams, out errMsg);
                                SelfcheckDoneEventArgs args = new SelfcheckDoneEventArgs {
                                    Result = _dicResults[this]
                                };
                                SelfcheckDone?.Invoke(this, args);
                            }
                        });
                    } catch (ObjectDisposedException) {
                        // 关闭窗口后仍有一定几率会进入主UI线程,此时访问界面元素会引发此异常,直接忽略即可
                    }
                }
            }
        }