Example #1
0
        private void RealTimeWatcher()
        {
            UIHelper.LogInfo(string.Format("RealTime Data를 {0}주기로 수집", _realTimeCollectInterval));

            int count      = 0;
            int checkCount = _realTimeCollectInterval / 100;

            while (!_shouldStop)
            {
                if (count < checkCount)
                {
                    // Wait
                    Thread.Sleep(100);

                    count++;
                    continue;
                }
                count = 0;

                // Collect Data from DB
                if (_machineInterface.ReadMachineRealTimeData() == false)
                {
                    UIHelper.UpdateDBCommStatus(false);
                    continue;
                }

                UIHelper.UpdateDBCommStatus(true);

                foreach (MachineInfo mInfo in _listMachineInfo)
                {
                    MachineRealTimeData rtData = _machineInterface.GetMachineRealTimeData(mInfo.ID);

                    _serverComm.SendMachineRealTimeData(rtData);
                }
            }

            UIHelper.LogInfo("RealTime Data 수집 종료");
        }