Chromatics.Chromatics.updateState C# (CSharp) Method

updateState() public method

public updateState ( string type, System col, [ col2, [ direction, [ speed ) : void
type string
col System
col2 [
direction [
speed [
return void
        public void updateState(string type, System.Drawing.Color col, [Optional]System.Drawing.Color col2, [Optional]bool direction, [Optional]int speed)
        {
            if (type == "reset")
            {
                if (RazerSDK != false)
                {
                    if (DeviceHeadset == true) { Headset.Instance.Clear(); }
                    if (DeviceKeyboard == true) { Keyboard.Instance.Clear(); }
                    if (DeviceKeypad == true) { Keypad.Instance.Clear(); }
                    if (DeviceMouse == true) { Mouse.Instance.Clear(); }
                    if (DeviceMousepad == true) { Mousepad.Instance.Clear(); }
                }
                if (CorsairSDK != false)
                {
                    if (CorsairKeyboardDetect == true)
                    {
                        CorsairKeyboard corKeyboard = CueSDK.KeyboardSDK;
                        ListKeyGroup allGroup = new ListKeyGroup(corKeyboard)
                        { Brush = new SolidColorBrush(System.Drawing.Color.Black) };
                        corKeyboard.Update();

                    }
                    if (CorsairMouseDetect == true)
                    {
                        CorsairMouse corMouse = CueSDK.MouseSDK;
                        //Unsupported
                    }
                    if (CorsairHeadsetDetect == true)
                    {
                        CorsairHeadset corHeadset = CueSDK.HeadsetSDK;
                        //Unsupported
                    }
                }
                if (LogitechSDK != false)
                {
                    if (DeviceLogitech == true)
                    {
                        if (LogiEffectRunning == true)
                        {
                            LogitechGSDK.LogiLedStopEffects();
                            Thread.Sleep(100);
                        }
                        LogitechGSDK.LogiLedSetLighting(0, 0, 0);
                    }
                }
            }
            else if (type == "static")
            {
                if (RazerSDK != false)
                {
                    new Task(() =>
                    {
                        if (DeviceHeadset == true) { Headset.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                        if (DeviceKeyboard == true)
                        {
                            Keyboard.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col));
                        }
                        if (DeviceKeypad == true) { Keypad.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                        if (DeviceMouse == true) { Mouse.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                        if (DeviceMousepad == true) { Mousepad.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                    }).Start();

                }
                if (CorsairSDK != false)
                {
                    new Task(() =>
                    {
                    if (CorsairKeyboardDetect == true)
                    {
                        UpdateKeyboard(col);
                    }
                    if (CorsairMouseDetect == true)
                    {
                        CorsairMouse corMouse = CueSDK.MouseSDK;
                        //Unsupported
                    }
                    if (CorsairHeadsetDetect == true)
                    {
                        CorsairHeadset corHeadset = CueSDK.HeadsetSDK;
                        //Unsupported
                    }
                    }).Start();
                }
                if (LogitechSDK != false)
                {
                    new Task(() =>
                    {
                        if (DeviceLogitech == true)
                        {
                            if (LogiEffectRunning == true)
                            {
                                LogitechGSDK.LogiLedStopEffects();
                                Thread.Sleep(100);
                            }

                            LogitechGSDK.LogiLedSetLighting((int)Math.Ceiling((double)(col.R * 100) / 255), (int)Math.Ceiling((double)(col.G * 100) / 255), (int)Math.Ceiling((double)(col.B * 100) / 255));
                            LogiEffectRunning = false;
                        }
                    }).Start();
                }
            }
            else if (type == "transition")
            {
                if (RazerSDK != false)
                {
                    new Task(() =>
                    {
                        if (DeviceHeadset == true) { Headset.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                        if (DeviceKeyboard == true)
                        {
                            transition(Corale.Colore.Core.Color.FromSystemColor(col), direction);
                        }
                        if (DeviceKeypad == true) { Keypad.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                        if (DeviceMouse == true) { Mouse.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                        if (DeviceMousepad == true) { Mousepad.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                    }).Start();
                }
                if (CorsairSDK != false)
                {
                    new Task(() =>
                    {
                        if (CorsairKeyboardDetect == true)
                        {
                            UpdateKeyboard(col);
                        }
                        if (CorsairMouseDetect == true)
                        {
                            CorsairMouse corMouse = CueSDK.MouseSDK;
                            //Unsupported
                        }
                        if (CorsairHeadsetDetect == true)
                        {
                            CorsairHeadset corHeadset = CueSDK.HeadsetSDK;
                            //Unsupported
                        }
                    }).Start();
                }
                if (LogitechSDK != false)
                {
                    new Task(() =>
                    {
                        if (DeviceLogitech == true)
                        {
                            if (LogiEffectRunning == true)
                            {
                                LogitechGSDK.LogiLedStopEffects();
                                Thread.Sleep(100);
                            }
                            LogitechGSDK.LogiLedSetLighting((int)Math.Ceiling((double)(col.R * 100) / 255), (int)Math.Ceiling((double)(col.G * 100) / 255), (int)Math.Ceiling((double)(col.B * 100) / 255));
                            LogiEffectRunning = false;
                        }
                    }).Start();
                }
            }
            else if (type == "wave")
            {
                if (RazerSDK != false)
                {
                    new Task(() =>
                    {
                        if (DeviceHeadset == true) { Headset.Instance.SetEffect(Corale.Colore.Razer.Headset.Effects.Effect.SpectrumCycling); }
                        if (DeviceKeyboard == true) { Keyboard.Instance.SetWave(Corale.Colore.Razer.Keyboard.Effects.Direction.LeftToRight); }
                        if (DeviceKeypad == true) { Keypad.Instance.SetWave(Corale.Colore.Razer.Keypad.Effects.Direction.LeftToRight); }
                        if (DeviceMouse == true) { Mouse.Instance.SetWave(Corale.Colore.Razer.Mouse.Effects.Direction.FrontToBack); }
                        if (DeviceMousepad == true) { Mousepad.Instance.SetWave(Corale.Colore.Razer.Mousepad.Effects.Direction.LeftToRight); }
                    }).Start();
                }
                if (CorsairSDK != false)
                {
                    new Task(() =>
                    {
                        if (CorsairKeyboardDetect == true)
                        {
                            UpdateKeyboard(col);
                        }
                        if (CorsairMouseDetect == true)
                        {
                            CorsairMouse corMouse = CueSDK.MouseSDK;
                            //Unsupported
                        }
                        if (CorsairHeadsetDetect == true)
                        {
                            CorsairHeadset corHeadset = CueSDK.HeadsetSDK;
                            //Unsupported
                        }
                    }).Start();
                }
                if (LogitechSDK != false)
                {
                    new Task(() =>
                    {
                        if (DeviceLogitech == true)
                        {
                            if (LogiEffectRunning == true)
                            {
                                LogitechGSDK.LogiLedStopEffects();
                                Thread.Sleep(100);
                            }

                            LogiColourCycle(col);
                            LogiEffectRunning = false;
                        }
                    }).Start();
                }
            }
            else if (type == "breath")
            {
                if (RazerSDK != false)
                {
                    new Task(() =>
                    {
                        if (DeviceHeadset == true) { Headset.Instance.SetBreathing(Corale.Colore.Core.Color.FromSystemColor(col)); }
                        if (DeviceKeyboard == true) { Keyboard.Instance.SetBreathing(Corale.Colore.Core.Color.FromSystemColor(col), Corale.Colore.Core.Color.FromSystemColor(col2)); }
                        if (DeviceKeypad == true) { Keypad.Instance.SetBreathing(Corale.Colore.Core.Color.FromSystemColor(col), Corale.Colore.Core.Color.FromSystemColor(col2)); }
                        if (DeviceMouse == true) { Mouse.Instance.SetBreathing(Corale.Colore.Core.Color.FromSystemColor(col), Corale.Colore.Core.Color.FromSystemColor(col2), Led.All); }
                        if (DeviceMousepad == true) { Mousepad.Instance.SetBreathing(Corale.Colore.Core.Color.FromSystemColor(col), Corale.Colore.Core.Color.FromSystemColor(col2)); }
                    }).Start();
                }
                if (CorsairSDK != false)
                {
                    new Task(() =>
                    {
                        if (CorsairKeyboardDetect == true)
                        {
                            UpdateKeyboard(col);
                        }
                        if (CorsairMouseDetect == true)
                        {
                            CorsairMouse corMouse = CueSDK.MouseSDK;
                            //Unsupported
                        }
                        if (CorsairHeadsetDetect == true)
                        {
                            CorsairHeadset corHeadset = CueSDK.HeadsetSDK;
                            //Unsupported
                        }
                    }).Start();
                }
                if (LogitechSDK != false)
                {
                    new Task(() =>
                    {
                        if (DeviceLogitech == true)
                        {
                            LogitechGSDK.LogiLedPulseLighting((int)Math.Ceiling((double)(col.R * 100) / 255), (int)Math.Ceiling((double)(col.G * 100) / 255), (int)Math.Ceiling((double)(col.B * 100) / 255), LogitechGSDK.LOGI_LED_DURATION_INFINITE, 60);
                            LogiEffectRunning = true;
                        }
                    }).Start();
                }

            }
            else if (type == "pulse")
            {
                if (RazerSDK != false)
                {
                    new Task(() =>
                    {
                        if (DeviceHeadset == true) { Headset.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                        if (DeviceKeyboard == true)
                        {
                            transitionConst(Corale.Colore.Core.Color.FromSystemColor(col), Corale.Colore.Core.Color.FromSystemColor(col2), true, speed);

                        }
                        if (DeviceKeypad == true) { Keypad.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                        if (DeviceMouse == true) { Mouse.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                        if (DeviceMousepad == true) { Mousepad.Instance.SetAll(Corale.Colore.Core.Color.FromSystemColor(col)); }
                    }, CTS.Token).Start();
                    RzPulse = true;
                }
                if (CorsairSDK != false)
                {
                    new Task(() =>
                    {
                        if (CorsairKeyboardDetect == true)
                        {
                            UpdateKeyboard(col);
                        }
                        if (CorsairMouseDetect == true)
                        {
                            CorsairMouse corMouse = CueSDK.MouseSDK;
                            //Unsupported
                        }
                        if (CorsairHeadsetDetect == true)
                        {
                            CorsairHeadset corHeadset = CueSDK.HeadsetSDK;
                            //Unsupported
                        }
                    }).Start();
                }
                if (LogitechSDK != false)
                {
                    new Task(() =>
                    {
                        if (DeviceLogitech == true)
                        {
                            if (LogiEffectRunning == true)
                            {
                                LogitechGSDK.LogiLedStopEffects();
                                Thread.Sleep(100);
                            }

                            LogitechGSDK.LogiLedSetLighting((int)Math.Ceiling((double)(col.R * 100) / 255), (int)Math.Ceiling((double)(col.G * 100) / 255), (int)Math.Ceiling((double)(col.B * 100) / 255));
                            LogiEffectRunning = false;
                        }
                    }).Start();
                }
            }
        }
Chromatics