Ejemplo n.º 1
0
        private bool HandleDrop(DragEventArgs e)
        {
            PanelColorButton Button = e.Source as PanelColorButton;

            if (Button == null)
            {
                return(false);
            }

            // A color is being dropped from another button.  Don't just update our color, since
            // that will just change the button color and not actually apply it.
            DataObject data = e.Data as DataObject;

            if (data == null)
            {
                return(false);
            }

            // Parse the color being dragged onto us, and set it.
            Color color = Helpers.ParseColorString(data.GetData(typeof(string)) as string);

            setColor(color);

            return(true);
        }
Ejemplo n.º 2
0
        private bool HandleDrop(DragEventArgs e)
        {
            PanelColorButton Button = e.Source as PanelColorButton;

            if (Button == null)
            {
                return(false);
            }

            // A color is being dropped from another button.  Don't just update our color, since
            // that will just change the button color and not actually apply it.
            DataObject data = e.Data as DataObject;

            if (data == null)
            {
                return(false);
            }

            // Parse the color being dragged onto us.
            Color color = Helpers.ParseColorString(data.GetData(typeof(string)) as string);

            // Update the panel color.
            int PanelIndex = Panel % 9;
            int Pad        = Panel < 9? 0:1;

            SMX.SMXConfig config;
            if (!SMX.SMX.GetConfig(Pad, out config))
            {
                return(false);
            }

            // Light colors are 8-bit values, but we only use values between 0-170.  Higher values
            // don't make the panel noticeably brighter, and just draw more power.
            color = Helpers.ScaleColor(color);
            config.stepColor[PanelIndex * 3 + 0] = color.R;
            config.stepColor[PanelIndex * 3 + 1] = color.G;
            config.stepColor[PanelIndex * 3 + 2] = color.B;

            SMX.SMX.SetConfig(Pad, config);
            CurrentSMXDevice.singleton.FireConfigurationChanged(this);
            return(true);
        }