Ejemplo n.º 1
0
        public LightOffTimer(Device device, TimeSpan duration, DeviceTimerCallBack timerCallback)
        {
            _device = device;
            _duration = duration;
            _timerCallback = timerCallback;

            _lightTimer = new Timer(_duration.TotalMilliseconds);
        }
Ejemplo n.º 2
0
        public void SetTimer(DeviceTimerCallBack timerCallback)
        {
            if (!DefaultOffMinutes.HasValue)
                return;

            if (null != _timer)
            {
                _timer.Reset();
                _timer = null;
            }

            _timer = new LightOffTimer(this, new TimeSpan(0, DefaultOffMinutes.Value, 0), timerCallback);
            _timer.Start();
        }