예제 #1
0
        public void SetProperties(LightBulbProperties lightBulbPropertiesToSet)
        {
            if (PlatformConverter.ToBool(lightBulbPropertiesToSet.SetBrightness) && PlatformConverter.ToBool(RaiseInProgress))
            {
                StopRaise();
            }
            if (PlatformConverter.ToBool(lightBulbPropertiesToSet.SetBrightness) && PlatformConverter.ToBool(LowerInProgress))
            {
                StopLower();
            }
            if (PlatformConverter.ToBool(lightBulbPropertiesToSet.SetBrightness) && PlatformConverter.ToBool(CycleDimInProgress))
            {
                StopCycleDim();
            }
            if (PlatformConverter.ToBool(lightBulbPropertiesToSet.SetHue) && PlatformConverter.ToBool(CycleHueInProgress))
            {
                StopCycleHue();
            }
            if (PlatformConverter.ToBool(lightBulbPropertiesToSet.SetSaturation) && PlatformConverter.ToBool(CycleSaturationInProgress))
            {
                StopCycleSaturation();
            }
            if (PlatformConverter.ToBool(lightBulbPropertiesToSet.SetColorTemperature) && PlatformConverter.ToBool(CycleColorTemperatureInProgress))
            {
                StopCycleColorTemperature();
            }

            SetHuePropertiesRequestAction(lightBulbPropertiesToSet);
        }
예제 #2
0
        public void BeginTemporaryChange()
        {
            using (new LockScope(_classLock))
            {
                if (_beforeTemporaryChangeProperties != null)
                {
                    return;
                }

                _beforeTemporaryChangeProperties            = new LightBulbProperties();
                _beforeTemporaryChangeProperties.Brightness = Brightness;
                switch (ColorMode)
                {
                case LightBulbColorMode.HueSaturation:
                    _beforeTemporaryChangeProperties.Hue           = Hue;
                    _beforeTemporaryChangeProperties.Saturation    = Saturation;
                    _beforeTemporaryChangeProperties.SetHue        = PlatformConverter.ToPlatformBool(true);
                    _beforeTemporaryChangeProperties.SetSaturation = PlatformConverter.ToPlatformBool(true);
                    break;

                case LightBulbColorMode.ColorTemperature:
                    _beforeTemporaryChangeProperties.ColorTemperature    = ColorTemperature;
                    _beforeTemporaryChangeProperties.SetColorTemperature = PlatformConverter.ToPlatformBool(true);
                    break;

                case LightBulbColorMode.XY:
                    _beforeTemporaryChangeProperties.XY    = XY;
                    _beforeTemporaryChangeProperties.SetXY = PlatformConverter.ToPlatformBool(true);
                    break;
                }
            }
        }
예제 #3
0
        public void EndTemporaryChange()
        {
            LightBulbProperties beforeTemporaryChangeProperties = null;

            using (new LockScope(_classLock))
            {
                if (_beforeTemporaryChangeProperties == null)
                {
                    return;
                }

                beforeTemporaryChangeProperties  = _beforeTemporaryChangeProperties;
                _beforeTemporaryChangeProperties = null;
            }

            SetProperties(beforeTemporaryChangeProperties);
        }