public MedicalCabinet(RfidReader currenRfidReader, string strPortBadgeAndLCD, bool isSchroff = false)
            : base(currenRfidReader, strPortBadgeAndLCD)
        {
            EventThread = new Thread(EventThreadProc)
            {
                Name = "SmartCabinet event", IsBackground = true
            };
            EventThread.Start();

            if (currenRfidReader.HardwareVersion.StartsWith("13"))
            {
                this._isSchroff = true;
                Rs232Display    = new Rs232Module("COM2");
                InitLCD();
                HideCursor();

                if (YAPI.RegisterHub("usb", ref errmsg) == YAPI.SUCCESS)
                {
                    bTempReady = true;
                }
                else
                {
                    ErrorMessage.ExceptionMessageBox.Show("error init YAPI", null);
                }
            }

            Clock.Interval = 1000;
            Clock.Elapsed += Timer_Tick;
            Clock.Start();
        }
Ejemplo n.º 2
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;
            }
        }
        protected Cabinet(RfidReader currenRfidReader, string strPortBadgeAndLCD)
        {
            Rs232Module = new Rs232Module(strPortBadgeAndLCD);
            MessageReceivedEventHandler msgReceivedEventHandler = UpdateMessage;

            Rs232Module.MessageEvent += msgReceivedEventHandler;

            CurrenRfidReader = currenRfidReader;

            if (CurrenRfidReader != null)
            {
                CurrenRfidReader.NotifyEvent += myDevice_NotifyEvent;
            }

            StrPortBadgeAndLCD = strPortBadgeAndLCD;
        }
        protected override void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            if (LedThread != null)
            {
                LedThread.Abort();
                LedThread.Join(1000);
                LedThread = null;
            }

            CancelPendingOperations();
            StopThread();
            Rs232Module.ClosePort();
            Thread.Sleep(500);
            if (_isSchroff)
            {
                Rs232Display.ClosePort();
            }
        }