Ejemplo n.º 1
0
        public void SampleHardware()
        {
            var status = _hardware.GetWarmerPlateStatus();

            if (status != _warmerStatus)
            {
                _warmerStatus = status;

                if (_warmerStatus == WarmerStatus.POT_NOT_EMPTY)
                {
                    _hardware.SetWarmerState(WarmerState.WARMER_ON);
                }
                else
                {
                    _hardware.SetWarmerState(WarmerState.WARMER_OFF);
                }

                if (WarmerStatusChangedEvent != null)
                {
                    WarmerStatusChangedEvent(this, new WarmerStatusEventArgs {
                        WarmerStatus = _warmerStatus
                    });
                }
            }
        }
Ejemplo n.º 2
0
 public WarmerPlate(IWarmerPlate hardware)
 {
     this._hardware     = hardware;
     this._warmerStatus = _hardware.GetWarmerPlateStatus();
     this._timer        = new Timer(new TimerCallback(SampleHardwareCallback), null, 0, 1000);
 }