예제 #1
0
        private void RestoreLeds()
        {
            Global.logger.LogLine("Corsair starting restoring leds", Logging_Level.Info);

            if (keyboard != null)
            {
                foreach (var key in saved_keys)
                {
                    keyboard[key.Key].Led.Color = key.Value;
                }
                keyboard.Update();
            }

            if (mouse != null)
            {
                foreach (var key in saved_mouse)
                {
                    mouse[key.Key].Color = key.Value;
                }
                mouse.Update();
            }

            if (headset != null)
            {
                foreach (var key in saved_headset)
                {
                    headset[key.Key].Color = key.Value;
                }
                headset.Update();
            }

            Global.logger.LogLine("Corsair restored leds", Logging_Level.Info);
        }
예제 #2
0
 public void ShowRGB(RGBValue rgb)
 {
     if (_lastColor == null)
     {
         _lastColor     = new CorsairColor(rgb.R, rgb.G, rgb.B);
         _headset.Brush = new SolidColorBrush(_lastColor);
     }
     else
     {
         // Don't need to instantiate it again and again
         _lastColor.R = rgb.R;
         _lastColor.G = rgb.G;
         _lastColor.B = rgb.B;
     }
     _headset.Update();
 }
예제 #3
0
        private void SendColorToPeripheral(Color color, bool forced = false)
        {
            if ((!previous_peripheral_Color.Equals(color) || forced))
            {
                if (Global.Configuration.allow_peripheral_devices)
                {
                    //Apply and strip Alpha
                    color = Color.FromArgb(255, Utils.ColorUtils.MultiplyColorByScalar(color, color.A / 255.0D));

                    if (mouse != null && !Global.Configuration.devices_disable_mouse)
                    {
                        if (mouse[CorsairLedId.B1] != null)
                        {
                            mouse[CorsairLedId.B1].Color = color;
                        }
                        if (mouse[CorsairLedId.B2] != null)
                        {
                            mouse[CorsairLedId.B2].Color = color;
                        }
                        if (mouse[CorsairLedId.B3] != null)
                        {
                            mouse[CorsairLedId.B3].Color = color;
                        }
                        if (mouse[CorsairLedId.B4] != null)
                        {
                            mouse[CorsairLedId.B4].Color = color;
                        }

                        mouse.Update(true);
                    }

                    if (headset != null && !Global.Configuration.devices_disable_headset)
                    {
                        if (headset[CorsairLedId.LeftLogo] != null)
                        {
                            headset[CorsairLedId.LeftLogo].Color = color;
                        }
                        if (headset[CorsairLedId.RightLogo] != null)
                        {
                            headset[CorsairLedId.RightLogo].Color = color;
                        }

                        headset.Update(true);
                    }

                    if (mousemat != null && !Global.Configuration.devices_disable_mouse)
                    {
                        if (mousemat[CorsairLedId.Zone1] != null)
                        {
                            mousemat[CorsairLedId.Zone1].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone2] != null)
                        {
                            mousemat[CorsairLedId.Zone2].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone3] != null)
                        {
                            mousemat[CorsairLedId.Zone3].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone4] != null)
                        {
                            mousemat[CorsairLedId.Zone4].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone5] != null)
                        {
                            mousemat[CorsairLedId.Zone5].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone6] != null)
                        {
                            mousemat[CorsairLedId.Zone6].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone7] != null)
                        {
                            mousemat[CorsairLedId.Zone7].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone8] != null)
                        {
                            mousemat[CorsairLedId.Zone8].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone9] != null)
                        {
                            mousemat[CorsairLedId.Zone9].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone10] != null)
                        {
                            mousemat[CorsairLedId.Zone10].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone11] != null)
                        {
                            mousemat[CorsairLedId.Zone11].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone12] != null)
                        {
                            mousemat[CorsairLedId.Zone12].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone13] != null)
                        {
                            mousemat[CorsairLedId.Zone13].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone14] != null)
                        {
                            mousemat[CorsairLedId.Zone14].Color = color;
                        }
                        if (mousemat[CorsairLedId.Zone15] != null)
                        {
                            mousemat[CorsairLedId.Zone15].Color = color;
                        }

                        mousemat.Update(true);
                    }

                    previous_peripheral_Color = color;
                    peripheral_updated        = true;
                }
                else
                {
                    if (peripheral_updated)
                    {
                        peripheral_updated = false;
                    }
                }
            }
        }