コード例 #1
0
ファイル: ScaleIndicator.cs プロジェクト: BECampbellIT/Demo
        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);
            }
        }
コード例 #2
0
ファイル: ScaleIndicator.cs プロジェクト: BECampbellIT/Demo
        public ScaleIndicator()
        {
            InitializeComponent();

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