Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            BreathingSpeeds speed = BreathingSpeeds.Medium;

            if (breathingFast.Checked)
            {
                speed = BreathingSpeeds.Fast;
            }
            else if (breathingMedium.Checked)
            {
                speed = BreathingSpeeds.Medium;
            }
            else if (breathingSlow.Checked)
            {
                speed = BreathingSpeeds.Slow;
            }

            BreathingTypes type = BreathingTypes.Single;

            if (breathingDoubleColorCheckBox.Checked)
            {
                type = BreathingTypes.Double;
            }
            if (breathingRandomColorCheckBox.Checked)
            {
                type = BreathingTypes.Random;
            }
            ourKeyboard.SetEffect_Breathing(pictureBox1.BackColor, pictureBox2.BackColor, 100, type, speed);
        }
Ejemplo n.º 2
0
        public virtual void SetEffect_Breathing(Color breathingColor1, Color breathingColor2,
                                                byte brightness, BreathingTypes breathingType, BreathingSpeeds speed)
        {
            var speedMap = new Dictionary <BreathingSpeeds, byte>
            {
                { BreathingSpeeds.Fast, 2 },
                { BreathingSpeeds.Medium, 4 },
                { BreathingSpeeds.Slow, 7 }
            };

            InternalSendWriteType44((byte)ByteSelectedEffectTypes.Breathing, 0xFF, 0xFF,
                                    (byte)(breathingType == BreathingTypes.Double ? 1 : 0),
                                    brightness, speedMap[speed],
                                    (byte)(breathingType == BreathingTypes.Random ? 1 : 0),
                                    breathingColor1, breathingColor2);
        }
        public void SetEffect_Breathing(Color breathingColor1, Color breathingColor2, byte brightness, BreathingTypes breathingType, BreathingSpeeds speed)
        {
            if (breathingType != BreathingTypes.Single)
            {
                //Only single breathing mode is implemented in this keyboard
                throw new ArgumentException();
            }

            //Both parameters are hardcoded here too
            InternalSendWriteType44((byte)ByteSelectedEffectTypes.Breathing, byte.MaxValue, breathingColor1, Color.Empty, 107);
        }