Esempio n. 1
0
        private void OnDeviceDataReceived(object sender, EventArgs e)
        {
            HangingBalanceEventArgs args = e as HangingBalanceEventArgs;

            if (args.Command == null)
            {
                return;
            }
            SerialDevice.CommandType type = args.Command.mCmdType;
            if (type == SerialDevice.CommandType.E0)
            {
                CommandE0 e0 = args.Command as CommandE0;
                ushort    ad = e0.GetAD();

                if (mHasReadTimes == 1)
                {
                    mAdWeightFirst = ad;
                }

                if (mHasReadTimes == 2)
                {
                    mAdWeightSecond = ad;
                }

                if (mHasReadTimes == 2)
                {
                    if (Math.Abs(mAdWeightSecond - mAdWeightFirst) <= mStandardError)
                    {
                        mAdWeights.Add((mAdWeightSecond + mAdWeightFirst) / 2);
                        StopTimer();
                        ShowNextCalibrateTips();
                        EnableControls(true);
                    }
                    else
                    {
                        //不合格要重新来,否则时钟不会停
                        mHasReadTimes = 0;
                        mTempAdWeights.Clear();
                    }
                }
            }
        }
Esempio n. 2
0
 private void OnDetectBalanceDataReceived(object sender, EventArgs e)
 {
     HangingBalanceEventArgs args = e as HangingBalanceEventArgs;
     // args.PortName
 }