/// <summary>
        /// Sends the common command to the used lights.
        /// </summary>
        public static void SendCommonCommond()
        {
            if (BridgeInformation.demoMode)
            {
                DemoLightController.SetPropertiesOfCommand(commonLightCommand);
                return;
            }

            BridgeInformation.client.SendCommandAsync(commonLightCommand, BridgeInformation.usedLights);
        }
        private static LightCommand commonLightCommand = new LightCommand(); // Used to store a light command to which multiple attitudes will be added.

        #region light selection

        /// <summary>
        /// Gets all lights and stores them in BridgeInformation.lights
        /// </summary>
        public static async Task GetAllLights()
        {
            if (BridgeInformation.demoMode)
            {
                if (BridgeInformation.lights.Length == 0)
                {
                    DemoLightController.CreatesDemoLights();
                }
                return;
            }

            var result = await BridgeInformation.client.GetBridgeAsync();

            BridgeInformation.lights = result.Lights.ToArray();
        }
        /// <summary>
        /// Turns the used lights off.
        /// </summary>
        public static void TurnOff()
        {
            if (!canControl)
            {
                return;
            }

            if (BridgeInformation.demoMode)
            {
                DemoLightController.TurnOff();
                return;
            }

            LightCommand lightCommand = new LightCommand();

            lightCommand.TurnOff();

            BridgeInformation.client.SendCommandAsync(lightCommand, BridgeInformation.usedLights);
        }
        /// <summary>
        /// Sets the color temperature of the used lights.
        /// </summary>
        /// <param name="newColorTemperature">New color temperature in mireds from 153 to 500</param>
        public static void SetColorTemperature(int newColorTemperature)
        {
            if (!canControl)
            {
                return;
            }

            if (BridgeInformation.demoMode)
            {
                DemoLightController.SetColorTemperature(newColorTemperature);
                return;
            }

            LightCommand lightCommand = new LightCommand();

            lightCommand.SetColor(newColorTemperature);

            BridgeInformation.client.SendCommandAsync(lightCommand, BridgeInformation.usedLights);
        }
        /// <summary>
        /// Sets the color of the used lights.
        /// </summary>
        /// <param name="rgbColor">New color in the color type of the API</param>
        public static void SetRGBColor(RGBColor rgbColor)
        {
            if (!canControl)
            {
                return;
            }

            if (BridgeInformation.demoMode)
            {
                DemoLightController.SetRGBColor(rgbColor);
                return;
            }

            LightCommand lightCommand = new LightCommand();

            lightCommand.SetColor(rgbColor);

            BridgeInformation.client.SendCommandAsync(lightCommand, BridgeInformation.usedLights);
        }
        /// <summary>
        /// Sets the brightness of the used lights.
        /// </summary>
        /// <param name="newBrightnessPercent">New brightness percent from 0 to 100</param>
        public static void SetBrightness(int newBrightnessPercent)
        {
            if (!canControl)
            {
                return;
            }

            if (BridgeInformation.demoMode)
            {
                DemoLightController.SetBrightness(newBrightnessPercent);
                return;
            }

            //The API has minimum brightness of 0 and a maximum of 254.
            //The following line converts the brightness in percent to the brightness of API
            byte newBrightness = (byte)((float)newBrightnessPercent / 100 * 254); //e.g. 50% --> 127

            LightCommand lightCommand = new LightCommand();

            lightCommand.Brightness = newBrightness;

            BridgeInformation.client.SendCommandAsync(lightCommand, BridgeInformation.usedLights);
        }