Esempio n. 1
0
        private void ToledoSerial_OnToledoStandardDataReceived(object sender, ToledoStandardData e)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <object, ToledoStandardData>(ToledoSerial_OnToledoStandardDataReceived), sender, e);
                return;
            }

            receiveTimes++;
            StringBuilder sb = new StringBuilder( );

            if (checkBox4.Checked)
            {
                sb.Append(DateTime.Now.ToString( ) + Environment.NewLine);
            }
            sb.Append(e.ToJsonString( ) + Environment.NewLine);
            textBox6.Text = sb.ToString( );

            textBox1.Text = e.SourceData.ToHexString(' ');
            textBox3.Text = Encoding.ASCII.GetString(e.SourceData);

            toledoDataControl1.SetToledoData(e);
            hslCurve1.AddCurveData("重量", e.Weight);
            hslDialPlate1.Value = e.Weight;

            label2.Text = "Receive Times:" + receiveTimes;
        }
        public void SetToledoData(ToledoStandardData data)
        {
            if (data.Suttle)
            {
                label2.BackColor = Color.Red;
                label1.BackColor = SystemColors.Control;
            }
            else
            {
                label1.BackColor = Color.Red;
                label2.BackColor = SystemColors.Control;
            }

            if (data.Symbol)
            {
                label3.BackColor = Color.Red;
                label4.BackColor = SystemColors.Control;
            }
            else
            {
                label4.BackColor = Color.Red;
                label3.BackColor = SystemColors.Control;
            }

            if (data.BeyondScope)
            {
                label6.BackColor = Color.Red;
                label5.BackColor = SystemColors.Control;
            }
            else
            {
                label5.BackColor = Color.Red;
                label6.BackColor = SystemColors.Control;
            }

            if (data.DynamicState)
            {
                label7.BackColor = Color.Red;
                label8.BackColor = SystemColors.Control;
            }
            else
            {
                label8.BackColor = Color.Red;
                label7.BackColor = SystemColors.Control;
            }

            textBox1.Text = data.Weight.ToString( );
            label10.Text  = data.Unit;
            textBox2.Text = data.Tare.ToString( );
        }
Esempio n. 3
0
        private void ToledoSerial_OnToledoStandardDataReceived(object sender, ToledoStandardData e)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <object, ToledoStandardData>(ToledoSerial_OnToledoStandardDataReceived));
                return;
            }

            StringBuilder sb = new StringBuilder( );

            if (checkBox4.Checked)
            {
                sb.Append(DateTime.Now.ToString( ) + Environment.NewLine);
            }
            sb.Append(e.ToJsonString( ) + Environment.NewLine);
            textBox6.Text = sb.ToString( );
        }