Пример #1
0
        public override void ShowProperties()
        {
            var layerProps = new HueProperties();

            layerProps.Name       = Name;
            layerProps.Hue        = Hue;
            layerProps.Colorize   = Colorize;
            layerProps.Saturation = Saturation;
            layerProps.Lightness  = Lightness;
            layerProps.UpdateHueRange();
            var prevH = Hue;
            var prevS = Saturation;
            var prevL = Lightness;
            var prevC = Colorize;

            layerProps.ValuesChanged += layerProps_ValuesChanged;
            if (layerProps.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Name       = layerProps.Name;
                Hue        = layerProps.Hue;
                Saturation = layerProps.Saturation;
                Lightness  = layerProps.Lightness;
                Colorize   = layerProps.Colorize;
            }
            else
            {
                Hue        = prevH;
                Saturation = prevS;
                Lightness  = prevL;
                Colorize   = prevC;
            }
            Invalidate();
        }
Пример #2
0
        // Method to set the color depending on the parameter value provided. Returns the object
        public HueProperties SetColor(string color)
        {
            var properties = new HueProperties();

            if (color == "green")
            {
                properties.bri = 254;
                properties.hue = 23456;
                properties.sat = 254;
                properties.on  = true;
            }

            if (color == "red")
            {
                properties.bri = 254;
                properties.hue = 908;
                properties.sat = 254;
                properties.on  = true;
            }

            return(properties);
        }