示例#1
0
        private void CycleWatcher()
        {
            UIHelper.LogInfo(string.Format("Cycle Data를 {0}주기로 체크", _cycleCheckInterval));

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

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

                    count++;
                    continue;
                }
                count = 0;

                // Check cycle complete flag
                if (_machineInterface.IsCompleteCycle() == true)
                {
                    if (_machineInterface.ReadMachineCycleData() == false)
                    {
                        UIHelper.UpdateDBCommStatus(false);
                        continue;
                    }

                    UIHelper.UpdateDBCommStatus(true);

                    // Collect Data from DB
                    foreach (MachineInfo mInfo in _listMachineInfo)
                    {
                        MachineCycleData cycleData = _machineInterface.GetMachineCycleData(mInfo.ID);

                        _serverComm.SendMachineCycleData(cycleData);
                    }
                }
            }

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