private void NumResult(object sender, NumberReceivedEventArgs e) { double RealTimeData = e.CfcMVResult; if (RealTimeData > 10)//有重量 { if (m_dPreData <= 10 && m_State == "2" && btnKS.Enabled == true) //启动 { //皮带重量由小于5到大于5时启动自动保存一次计量 this.StrapStart(); //if (System.IO.File.Exists(PublicComponent.Constant.RunPath + "\\ding.wav")) // PlaySound(PublicComponent.Constant.RunPath + "\\ding.wav");//播放启动声音 } } else { if (m_dPreData > 10 && m_State == "2" && btnWC.Enabled == true)//启动 { //皮带重量由大于5到小于5时启动自动保存二次计量 this.StrapComplete(); //if (System.IO.File.Exists(PublicComponent.Constant.RunPath + "\\stop.wav")) // PlaySound(PublicComponent.Constant.RunPath + "\\stop.wav");//播放停止声音 } } m_dPreData = RealTimeData; this.tbLJLL.Text = e.CfcTLResult.ToString("#0.000"); this.tbSSLL.Text = e.CfcMVResult.ToString("#0.0"); if (m_State == "0") m_State = "2"; }
private void mycom1_NumReceived(object sender, NumberReceivedEventArgs e) { NumReceivedEvent fc = new NumReceivedEvent(NumResult); try { this.Invoke(fc, new object[] { null, e }); } catch { ; } }