Example #1
0
        public void Toggle()
        {
            if (_direction == DimmableDirection.Up)
            {
                if (_currentStep < _maxStep)
                {
                    _currentStep++;
                }
                if (_currentStep == _maxStep)
                {
                    _direction = DimmableDirection.Down;
                }
            }
            else
            {
                if (0 < _currentStep)
                {
                    _currentStep--;
                }
                if (_currentStep == 0)
                {
                    _direction = DimmableDirection.Up;
                }
            }

            DisplayState();
        }
Example #2
0
 public DimmableLight()
 {
     _maxStep     = _colorSteps.Length - 1;
     _currentStep = 0;
     _direction   = DimmableDirection.Up;
 }