Beispiel #1
0
        protected override void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            CancelPendingOperations();
            StopThread();
            Rs232Module.ClosePort();
            Thread.Sleep(500);

            if (_fridgeType == FridgeType.FT_CAREL)
            {
                if (_tempFridgeReaderCarel != null)
                {
                    _tempFridgeReaderCarel.StopThread();
                    Thread.Sleep(500);
                    _tempFridgeReaderCarel = null;
                }
            }

            if (_fridgeType == FridgeType.FT_EVERCOM)
            {
                if (_tempFridgeReaderEvercom == null)
                {
                    return;
                }
                _tempFridgeReaderEvercom.StopThread();
                Thread.Sleep(500);
                _tempFridgeReaderEvercom = null;
            }
            if (_fridgeType == FridgeType.FT_PT100)
            {
                if (_tempFridgeReaderPT100 == null)
                {
                    return;
                }
                _tempFridgeReaderPT100.StopThread();
                Thread.Sleep(500);
                _tempFridgeReaderPT100 = null;
            }
            if (_fridgeType == FridgeType.FT_FANEM)
            {
                if (_tempFridgeFanem == null)
                {
                    return;
                }
                _tempFridgeFanem.StopThread();
                Thread.Sleep(500);
                _tempFridgeFanem = null;
            }
        }
Beispiel #2
0
        public FridgeCabinet(RfidReader currenRfidReader, string strPortBadgeAndLCD, string strPortTempReader, FridgeType fridgeType)
            : base(currenRfidReader, strPortBadgeAndLCD)
        {
            StrPortTempReader = strPortTempReader;
            _fridgeType       = fridgeType;

            EventThread = new Thread(EventThreadProc)
            {
                Name = "SmartCabinet event", IsBackground = true
            };
            EventThread.Start();

            Clock.Interval = 1000;
            Clock.Elapsed += Timer_Tick;
            Clock.Start();

            if (string.IsNullOrEmpty(strPortTempReader))
            {
                return;
            }

            if (fridgeType == FridgeType.FT_CAREL)
            {
                _tempFridgeReaderCarel = new TempFridgeThreadCarel(strPortTempReader);
                _tempFridgeReaderCarel.StartThread();
            }

            if (fridgeType == FridgeType.FT_EVERCOM)
            {
                _tempFridgeReaderEvercom = new TempFridgeThreadEvercom(strPortTempReader);
                _tempFridgeReaderEvercom.StartThread();
            }

            if (fridgeType == FridgeType.FT_PT100)
            {
                _tempFridgeReaderPT100 = new TempFridgeThreadPT100();
                _tempFridgeReaderPT100.StartThread();
            }
            if (fridgeType == FridgeType.FT_FANEM)
            {
                _tempFridgeFanem = new TempFridgeFanem(strPortTempReader);
                _tempFridgeFanem.StartThread();
            }
        }