Beispiel #1
0
        // 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;
            }));
        }
Beispiel #2
0
        public void test_NetGrossValueStringComment_0Decimals(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);

            string strValue = _wtxObj.NetGrossValueStringComment(_wtxObj.GrossValue, 0);

            double dValue = _wtxObj.GrossValue / Math.Pow(10, 0);

            Assert.AreEqual(dValue.ToString(), strValue);
        }