Example #1
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            if (sr == null)
            {
                return;
            }

            while (true)
            {
                string res = sr.PollScaleWeight();
                if (res != null)
                {
                    if (sr.settings.localTare)
                    {
                        decimal dummyNet;
                        decimal dummyTare;

                        sr.InterpretResult(res, out grossWeight, out dummyNet, out dummyTare, out stab);
                        netWeight = grossWeight - tareWeight;
                    }
                    else
                    {
                        sr.InterpretResult(res, out grossWeight, out netWeight, out tareWeight, out stab);
                    }
                }
                else
                {
                    grossWeight = netWeight = tareWeight = 0;
                    stab        = ScaleReader.Stability.unknown;
                }
                UpdateComponents();
                Thread.Sleep(200);
            }
        }
Example #2
0
        public ScaleIndicator()
        {
            InitializeComponent();

            netWeight   = 0;
            grossWeight = 0;
            tareWeight  = 0;
            stab        = ScaleReader.Stability.unknown;
        }