コード例 #1
0
        public void testUnit_t(Behavior behavior)
        {
            _jetTestConnection = new TestJetbusConnection(behavior, "wss://172.19.103.8:443/jet/canopen", "Administrator", "wtx", delegate { return(true); });

            _wtxObj = new WtxJet(_jetTestConnection);

            _wtxObj.Connect(this.OnConnect, 100);

            value = _wtxObj.Unit;

            Assert.AreEqual("t", _wtxObj.UnitStringComment());
        }
コード例 #2
0
ファイル: LiveValue.cs プロジェクト: leistner/ModbusTCP_WTX
        // Event method, which will be triggered after a interval of the timer is elapsed-
        // After triggering (after 500ms) the register is read.
        private void JetbusOnTimedEvent(Object source, ElapsedEventArgs e)
        {
            int taraValue = 0;

            try
            {
                taraValue = _wtxObj.GrossValue - _wtxObj.NetValue;
            }
            catch (Exception exc)
            {
                _aTimer.Stop();
                _aTimer.Enabled = false;
                Console.WriteLine(exc.ToString());
            }

            textBox2.Invoke(new Action(() =>
            {
                try
                {
                    textBox2.Text = "Net:" + _wtxObj.NetGrossValueStringComment(_wtxObj.NetValue, _wtxObj.Decimals) + _wtxObj.UnitStringComment(_wtxObj.Unit) + Environment.NewLine
                                    + "Gross:" + _wtxObj.NetGrossValueStringComment(_wtxObj.GrossValue, _wtxObj.Decimals) + _wtxObj.UnitStringComment(_wtxObj.Unit) + Environment.NewLine
                                    + "Tara:" + _wtxObj.NetGrossValueStringComment(taraValue, _wtxObj.Decimals) + _wtxObj.UnitStringComment(_wtxObj.Unit);
                    textBox2.TextAlign = HorizontalAlignment.Right;
                }
                catch (Exception exx)
                {
                    Console.WriteLine(exx.ToString());
                }

                pictureBox1.Image = WTXJetGUISimple.Properties.Resources.NE107_DiagnosisActive;
            }));
        }