Exemplo n.º 1
0
        public bool IsPeripheralConnected() => _deviceProvider.Devices.Any(d => d.DeviceInfo.DeviceType == RGBDeviceType.Mouse); //TODO DarthAffe 03.02.2019: Which devices are "peripherals"?

        public bool Initialize()
        {
            lock (_lock)
            {
                if (IsInitialized())
                {
                    return(true);                 //DarthAffe 03.02.2019: I'm not sure if that's intended, but to me it seems aurora has a threading-issue in the initialization-part
                }
                try
                {
                    _surface.LoadDevices(_deviceProvider, throwExceptions: true, exclusiveAccessIfPossible: false);
                    _ledGroup?.Detach(); //DarthAffe 03.02.2019: This should never run, but safety first
                    _ledGroup = new ListLedGroup(_deviceProvider.Devices.SelectMany(d => d))
                    {
                        Brush = _brush
                    };
                    //rgbDevice  = new CorsairDeviceProvider();
                    // _deviceProvider.Initialize(RGBDeviceType.Fan|RGBDeviceType.Cooler|RGBDeviceType.HeadsetStand);


                    //RGB.NET.Core.Color c = new RGB.NET.Core.Color(27, 184, 235);
                    //ledGroup.Brush = new SolidColorBrush(c);
                    //_surface.Update();
                    return(IsInitialized());
                }
                catch (Exception ex)
                {
                    Global.logger.Error(ex, $"RGB.NET device ({GetDeviceName()}), Exception! Message: " + ex.Message);
                    return(false);
                }
            }
        }
Exemplo n.º 2
0
        public static void GadgetLighting(int gadget, int teamValue)
        {
            ILedGroup LedGroup = new ListLedGroup(Stuff.keyboard, true, CorsairLedId.G);

            if (gadget > 0)
            {
                LedGroup.Brush = Stuff.brushGreen; // Gadget still available
            }
            else
            {
                if (teamValue == 0)
                {
                    SolidColorBrush blueTeam = new SolidColorBrush(Color.Blue);
                    blueTeam.Brightness = 0.4F;
                    LedGroup.Brush      = blueTeam;
                }
                else
                {
                    SolidColorBrush orangeTeam = new SolidColorBrush(Color.OrangeRed);
                    orangeTeam.Brightness = 0.4F;
                    LedGroup.Brush        = orangeTeam;
                }
            }
            Stuff.keyboard.Update();
        }
Exemplo n.º 3
0
        public void UpdateSurfaceLedGroup()
        {
            if (_surfaceLedGroup == null)
            {
                // Apply the application wide brush and decorator
                BitmapBrush      = new BitmapBrush(new Scale(_renderScaleSetting.Value), _sampleSizeSetting);
                _surfaceLedGroup = new ListLedGroup(Surface.Leds)
                {
                    Brush = BitmapBrush
                };
                return;
            }

            lock (_surfaceLedGroup)
            {
                // Clean up the old background
                _surfaceLedGroup.Detach();

                // Apply the application wide brush and decorator
                BitmapBrush.Scale = new Scale(_renderScaleSetting.Value);
                _surfaceLedGroup  = new ListLedGroup(Surface.Leds)
                {
                    Brush = BitmapBrush
                };
            }

            lock (BitmapBrush)
            {
            }
        }
Exemplo n.º 4
0
        public override void Init()
        {
            base.Init();
            FunctionGroup = AddGroup(CorsairLedId.Escape, CorsairLedId.F1,
                                     CorsairLedId.F4, CorsairLedId.F6, CorsairLedId.F7, CorsairLedId.F8, CorsairLedId.F9, CorsairLedId.F10, CorsairLedId.Tab);
            HotbarGroup = AddGroup(CorsairLedId.D1, CorsairLedId.D2, CorsairLedId.D3,
                                   CorsairLedId.D4, CorsairLedId.D5, CorsairLedId.D6, CorsairLedId.D7,
                                   CorsairLedId.D8, CorsairLedId.D9, CorsairLedId.D0);
            RotateGroup = AddGroup(CorsairLedId.Insert, CorsairLedId.Home, CorsairLedId.PageUp,
                                   CorsairLedId.Delete, CorsairLedId.End, CorsairLedId.PageDown);
            MovementGroup = AddGroup(CorsairLedId.Q, CorsairLedId.W, CorsairLedId.E,
                                     CorsairLedId.A, CorsairLedId.S, CorsairLedId.D, CorsairLedId.C);
            BuildingGroup = AddGroup(CorsairLedId.P, CorsairLedId.BracketLeft,
                                     CorsairLedId.BracketRight, CorsairLedId.N, CorsairLedId.M);
            InteractGroup = AddGroup(CorsairLedId.Backspace, CorsairLedId.Y, CorsairLedId.CapsLock, CorsairLedId.F,
                                     CorsairLedId.I, CorsairLedId.G, CorsairLedId.K, CorsairLedId.L, CorsairLedId.Z, CorsairLedId.X);
            ViewGroup = AddGroup(CorsairLedId.V, CorsairLedId.LeftAlt, CorsairLedId.UpArrow,
                                 CorsairLedId.LeftArrow, CorsairLedId.DownArrow, CorsairLedId.RightArrow);
            ModifierGroup = AddGroup(CorsairLedId.LeftShift, CorsairLedId.LeftCtrl);
            KeyManagers.Add(new MediaKeyManager());
            KeyManagers.Add(new TypeFlashKeyManager()
            {
                AppliedKeys = MovementGroup.GetLeds(),
                FlashColor  = FromArgb(0xFF00FFFF),
            });
            KeyManagers.Add(new ModifierKeyManager());
            ListLedGroup FlashyKeys = AddFlashyKeysGroup();

            FlashyKeys.AddLed(CorsairLedId.CapsLock);
            FlashyKeys.RemoveLeds(MovementGroup.GetLeds());
            KeyManagers.Add(new TypeFlashKeyManager()
            {
                AppliedKeys = FlashyKeys.GetLeds()
            });
        }
Exemplo n.º 5
0
            /// <summary>
            /// Turns all leds off
            /// </summary>
            public static void AllLedOff()
            {
                Clog("Setting All LED Off Effect");
                ILedGroup ledGroup = new ListLedGroup(surface.Leds);

                ledGroup.Brush = new SolidColorBrush(new Color(0, 0, 0));
            }
Exemplo n.º 6
0
        public void Run()
        {
            CueSDK.UpdateMode = UpdateMode.Continuous;
            // Add a black background. We want this to be semi-transparent to add some sort of fade-effect - this will smooth everything out a bit
            // Note that this isn't a 'real effect' since it's update-rate dependent. A real effect would do always the same thing not mather how fast the keyboard updates.
            _keyboard.Brush = new SolidColorBrush(new CorsairColor(96, 0, 0, 0));
            // Add our song-beat-effect. Remember to uncomment the update in the spectrum effect if you want to remove this.
            ListLedGroup songBeatGroup = new ListLedGroup(_keyboard, _keyboard);

            songBeatGroup.Brush = new SolidColorBrush(new CorsairColor(127, 164, 164, 164));
            songBeatGroup.Brush.AddEffect(new SongBeatEffect(_soundDataProcessor));

            // Add our spectrum-effect using the soundDataProcessor and a rainbow from purple to red as gradient
            ListLedGroup spectrumGroup = new ListLedGroup(_keyboard, _keyboard);

            spectrumGroup.Brush = new AudioSpectrumBrush(_soundDataProcessor, new RainbowGradient(300, -14));

            // Hook onto the keyboard update and process data
            _keyboard.Updating += (sender, args) => _soundDataProcessor.Process();

            // If you don't like rainbows replace the gradient with anything you like. For example:
            //_keyboard.AttachEffect(new AudioSpectrumEffect(_soundDataProcessor, new LinearGradient(new GradientStop(0f, Color.Blue), new GradientStop(1f, Color.Red))));

            // We need something to block since the keyboard-effect-update-loop is running async and the console-app would exit otherwise.
            Console.WriteLine("Press any key to exit ...");
            Console.ReadKey();
        }
Exemplo n.º 7
0
 public override void OnInit(Profile profile)
 {
     base.OnInit(profile);
     CapsLockKey   = profile.GetSingleLedGroup(CorsairLedId.CapsLock);
     NumLockKey    = profile.GetSingleLedGroup(CorsairLedId.NumLock);
     ScrollLockKey = profile.GetSingleLedGroup(CorsairLedId.ScrollLock);
     MuteKey       = profile.GetSingleLedGroup(CorsairLedId.Mute);
 }
 public override void OnInit(Profile profile)
 {
     base.OnInit(profile);
     if (SpecialKeysGroup == null)
     {
         SpecialKeysGroup = profile.AddGroup(CorsairLedId.Brightness, CorsairLedId.WinLock);
     }
 }
Exemplo n.º 9
0
        internal override void Initialize()
        {
            LedGroup = new ListLedGroup();
            Layer.RenderPropertiesUpdated += LayerOnRenderPropertiesUpdated;

            InitializeProperties();
            UpdateLedGroup();
        }
Exemplo n.º 10
0
        public ListLedGroup AddFlashyKeysGroup()
        {
            ListLedGroup group = AddGroup(Keyboard.GetLeds());

            group.RemoveLed(CorsairLedId.Brightness, CorsairLedId.WinLock, CorsairLedId.Mute, CorsairLedId.CapsLock,
                            CorsairLedId.Stop, CorsairLedId.ScanPreviousTrack, CorsairLedId.PlayPause, CorsairLedId.ScanNextTrack,
                            CorsairLedId.LeftShift, CorsairLedId.LeftCtrl, CorsairLedId.LeftGui, CorsairLedId.LeftAlt,
                            CorsairLedId.RightShift, CorsairLedId.RightCtrl, CorsairLedId.RightGui, CorsairLedId.RightAlt);
            return(group);
        }
Exemplo n.º 11
0
            /// <summary>
            /// Sets all leds to a static color
            /// </summary>
            public static void StaticColor(int R = 255, int G = 255, int B = 255)
            {
                Clog(String.Format("RGB -- Setting Static Color -- Color: {0}, {1}, {2}", R, G, B));
                ILedGroup ledGroup = new ListLedGroup(surface.Leds);

                while (true)
                {
                    ledGroup.Brush = new  SolidColorBrush(new Color(R, G, B));
                }
            }
Exemplo n.º 12
0
 /// <summary>
 /// Converts the given <see cref="AbstractLedGroup" /> to a <see cref="ListLedGroup" />.
 /// </summary>
 /// <param name="ledGroup">The <see cref="AbstractLedGroup" /> to convert.</param>
 /// <returns>The converted <see cref="ListLedGroup" />.</returns>
 public static ListLedGroup ToListLedGroup(this AbstractLedGroup ledGroup)
 {
     ListLedGroup listLedGroup = ledGroup as ListLedGroup;
     if (listLedGroup == null)
     {
         bool wasAttached = ledGroup.Detach();
         listLedGroup = new ListLedGroup(ledGroup.Device, wasAttached, ledGroup.GetLeds()) { Brush = ledGroup.Brush };
     }
     return listLedGroup;
 }
Exemplo n.º 13
0
        /// <summary>
        /// Returns a new <see cref="ListLedGroup" /> which contains all LEDs from the given ledgroup excluding the specified ones.
        /// </summary>
        /// <param name="ledGroup">The base ledgroup.</param>
        /// <param name="ledIds">The LEDs to exclude.</param>
        /// <returns>The new <see cref="ListLedGroup" />.</returns>
        public static ListLedGroup Exclude(this AbstractLedGroup ledGroup, params CorsairLed[] ledIds)
        {
            ListLedGroup listLedGroup = ledGroup.ToListLedGroup();

            foreach (CorsairLed led in ledIds)
            {
                listLedGroup.RemoveLed(led);
            }
            return(listLedGroup);
        }
Exemplo n.º 14
0
        private static void AddTestBrush(ICueDevice device, IBrush brush)
        {
            if (device == null)
            {
                return;
            }

            device.Brush = (SolidColorBrush)Color.Black;
            ILedGroup leds = new ListLedGroup(device, device);

            leds.Brush = brush;
        }
Exemplo n.º 15
0
        static void Main()
        {
            var config = new NLog.Config.LoggingConfiguration();

            // Targets where to log to: File and Console
            var logfile = new NLog.Targets.FileTarget("logfile")
            {
                FileName = "debugtool.log"
            };

            // Rules for mapping loggers to targets
            config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile);

            // Apply config
            LogManager.Configuration = config;

            RGBSurface surface = RGBSurface.Instance;

            LoadDeviceProviders();
            surface.AlignDevices();

            foreach (IRGBDevice device in surface.Devices)
            {
                device.UpdateMode = DeviceUpdateMode.Sync | DeviceUpdateMode.SyncBack;
            }

            UpdateTrigger = new TimerUpdateTrigger {
                UpdateFrequency = 1.0 / 60
            };
            surface.RegisterUpdateTrigger(UpdateTrigger);

            ILedGroup group = new ListLedGroup(surface.Leds);


            // Create new gradient
            IGradient gradient = new RainbowGradient();

            // Add a MoveGradientDecorator to the gradient
            gradient.AddDecorator(new RGB.NET.Decorators.Gradient.MoveGradientDecorator());

            // Make new LinearGradientBrush from gradient
            LinearGradientBrush nBrush = new LinearGradientBrush(gradient);

            // Apply LinearGradientBrush to led group
            group.Brush = nBrush;

            // Start UpdateTrigger, without this, the gradient will be drawn, but will not move.
            UpdateTrigger.Start();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
Exemplo n.º 16
0
        internal override void Initialize()
        {
            if (RgbService == null)
            {
                throw new ArtemisCoreException("Cannot initialize RGB.NET layer brush because RgbService is not set");
            }

            LedGroup = new ListLedGroup(RgbService.Surface);
            Layer.RenderPropertiesUpdated += LayerOnRenderPropertiesUpdated;

            InitializeProperties();
            UpdateLedGroup();
        }
Exemplo n.º 17
0
        private static void RunLedTest()
        {
            var kernel = new StandardKernel(new MainLedInjector());

            using (var service = kernel.Get <ILedService>())
            {
                var surface  = kernel.Get <RGBSurface>();
                var provider = kernel.Get <IRGBDeviceProvider>();
                service.LoadDevices(provider);
                service.InitializeDevices();

                ILedGroup lightBar = new ListLedGroup(surface.Leds.Where(led => led.LedRectangle.Location.Y <= 6));


                ConsoleKeyInfo key;
                do
                {
                    key = Console.ReadKey();
                    switch (key.Key)
                    {
                    case ConsoleKey.NumPad0:
                        service.Blink();
                        break;

                    case ConsoleKey.NumPad1:
                        service.Blink(lightBar.GetLeds());
                        break;

                    case ConsoleKey.NumPad2:
                        service.Wave(Direction.DownTop);
                        break;

                    case ConsoleKey.NumPad3:
                        service.Wave(Direction.LeftRight);
                        break;

                    case ConsoleKey.NumPad4:
                        service.Wave(Direction.TopDown);
                        break;

                    case ConsoleKey.NumPad5:
                        service.Wave(Direction.RightLeft);
                        break;

                    default:
                        break;
                    }
                }while (key.Key != ConsoleKey.Escape);
            }
        }
Exemplo n.º 18
0
        public override void Init()
        {
            base.Init();
            AllKeys = AddGroup(Keyboard.Leds);
            KeyManagers.Add(new MediaKeyManager());
            ListLedGroup FlashyKeysGroup = AddFlashyKeysGroup();

            KeyManagers.Add(new TypeFlashKeyManager()
            {
                AppliedKeys = FlashyKeysGroup.GetLeds(),
                FlashColor  = FromArgb(0xFFFFFFFF),
            });
            KeyManagers.Add(new ModifierKeyManager());
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            RGBSurface surface = RGBSurface.Instance;

            surface.Exception += eventArgs => Console.WriteLine(eventArgs.Exception.Message);

            TimerUpdateTrigger updateTrigger = new TimerUpdateTrigger();

            updateTrigger.UpdateFrequency = 1.0 / 60.0;
            surface.RegisterUpdateTrigger(updateTrigger);
            updateTrigger.Start();

            bool          throwExceptions = true;
            RGBDeviceType loadType        = (RGBDeviceType)(-1);

            //RGBDeviceType loadType = RGBDeviceType.Keyboard;

            surface.LoadDevices(RGB.NET.Devices.CoolerMaster.CoolerMasterDeviceProvider.Instance, loadType, throwExceptions: throwExceptions);
            surface.LoadDevices(RGB.NET.Devices.Corsair.CorsairDeviceProvider.Instance, loadType, throwExceptions: throwExceptions);
            surface.LoadDevices(RGB.NET.Devices.DMX.DMXDeviceProvider.Instance, loadType, throwExceptions: throwExceptions);
            surface.LoadDevices(RGB.NET.Devices.Logitech.LogitechDeviceProvider.Instance, loadType, throwExceptions: throwExceptions);
            //MSI DLL Broken -- surface.LoadDevices(RGB.NET.Devices.Msi.MsiDeviceProvider.Instance, loadType, throwExceptions: throwExceptions);
            surface.LoadDevices(RGB.NET.Devices.Novation.NovationDeviceProvider.Instance, loadType, throwExceptions: throwExceptions);
            surface.LoadDevices(RGB.NET.Devices.Razer.RazerDeviceProvider.Instance, loadType, throwExceptions: throwExceptions);
            surface.LoadDevices(RGB.NET.Devices.SteelSeries.SteelSeriesDeviceProvider.Instance, loadType, throwExceptions: throwExceptions);
            surface.LoadDevices(RGB.NET.Devices.WS281X.WS281XDeviceProvider.Instance, loadType, throwExceptions: throwExceptions);

            surface.AlignDevices();

            //List Detected Devices of loadType
            Console.WriteLine("Device Count: " + RGBSurface.Instance.Devices.Count());

            foreach (IRGBDevice device in surface.Devices)
            {
                Console.WriteLine(device.DeviceInfo.DeviceName + " || " + device.DeviceInfo.DeviceType + " || " + device.DeviceInfo.Manufacturer + " || " + device.DeviceInfo.Model);
            }

            ILedGroup ledGroup = new ListLedGroup(surface.Leds);

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            while (true)
            {
                double time = stopwatch.Elapsed.TotalMilliseconds / 400.0;
                ledGroup.Brush = new RadialGradientBrush(new Point(0.5 + 0.4 * Math.Cos(time), 0.5 + 0.4 * Math.Sin(time)), new RainbowGradient());
            }

            Console.ReadKey();
        }
Exemplo n.º 20
0
            /// <summary>
            /// Creates a rainbow effect by iterating through hue values.
            /// How fast the effect goes depends on the speed param, and the hueStep param.
            ///     The higher the speed value, the lower the hueStep should be.
            ///     At high delay times, lighting updates can be seen. This can be offset
            ///         by reducing how much the hue value is incremented each loop.
            ///
            /// Speed Values:
            ///     Fastest Reccomended - Speed: 5 at hueStep: 0.01
            ///     Good Middle Speed   - Speed: 50 at hueStep: 0.01
            ///     Slowest Reccomended - Speed: 100 at hueStep: 0.001
            /// </summary>
            /// <param name="speed"></param>
            public static void FadingEffect(int speed = 50, double hueStep = 0.01)
            {
                Clog(String.Format("Setting Rainbow Fade Effect -- Speed: {0} - Hue Step: {1}", speed, hueStep));
                ILedGroup ledGroup = new ListLedGroup(surface.Leds);

                while (true)
                {
                    for (double j = 0; j < 1; j += hueStep)
                    {
                        RGBColor c = ColorMethods.HSLToRGB(j, 1.0, 0.5);
                        ledGroup.Brush = new SolidColorBrush(new Color(c.R, c.G, c.B));
                        Thread.Sleep(speed);
                    }
                }
            }
Exemplo n.º 21
0
        /// <summary>
        ///   Converts the given <see cref="AbstractLedGroup" /> to a <see cref="ListLedGroup" />.
        /// </summary>
        /// <param name="ledGroup">The <see cref="AbstractLedGroup" /> to convert.</param>
        /// <returns>The converted <see cref="ListLedGroup" />.</returns>
        public static ListLedGroup ToListLedGroup(this AbstractLedGroup ledGroup)
        {
            var listLedGroup = ledGroup as ListLedGroup;

            // ReSharper disable once InvertIf
            if (listLedGroup == null)
            {
                var wasAttached = ledGroup.Detach();
                listLedGroup = new ListLedGroup(ledGroup.Device, wasAttached, ledGroup.GetLeds())
                {
                    Brush = ledGroup.Brush
                };
            }
            return(listLedGroup);
        }
Exemplo n.º 22
0
 public override void OnInit(Profile profile)
 {
     base.OnInit(profile);
     MuteKeyManager = new LockKeyManager()
     {
         BrushDisabled  = new SolidColorBrush(Profile.FromArgb(0x00000000)),
         BrushEnabled   = new SolidColorBrush(Profile.FromArgb(0xFFBB0000)),
         ManageCapsLock = false,
         ManageMuteKey  = true,
     };
     MuteKeyManager.OnInit(profile);
     MediaGroup = profile.AddGroup(CorsairLedId.Stop, CorsairLedId.ScanPreviousTrack,
                                   CorsairLedId.PlayPause, CorsairLedId.ScanNextTrack);
     MediaGroup2 = profile.AddGroup(MediaGroup.GetLeds());
     MediaGroup3 = profile.AddGroup(MediaGroup.GetLeds());
 }
Exemplo n.º 23
0
        public GraphicsDecorator(ListLedGroup ledGroup)
        {
            var leds = ledGroup.GetLeds().ToList();

            if (!leds.Any())
            {
                _bitmap = null;
            }
            else
            {
                var width  = leds.Max(l => l.AbsoluteLedRectangle.X + l.AbsoluteLedRectangle.Width);
                var height = leds.Max(l => l.AbsoluteLedRectangle.Y + l.AbsoluteLedRectangle.Height);

                _bitmap = new DirectBitmap((int)width, (int)height);
            }
        }
Exemplo n.º 24
0
        public static bool SetColor(RGBSurface surface, string type, Color color, LedEffect effect = 0)
        {
            IList <Device> devices = GetDevices(surface, type);

            try
            {
                ILedGroup ledGroup = new ListLedGroup(surface.Leds);
                ledGroup.Brush = new SolidColorBrush(color);
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Exemplo n.º 25
0
        static void Main(string[] args)
        {
            try
            {
                OpenRGBDeviceProvider.Instance.DeviceDefinitions.Add(new OpenRGBServerDefinition {
                    ClientName = "TestProgram", Ip = "127.0.0.1", Port = 6742
                });

                List <IRGBDeviceProvider> deviceProviders = new List <IRGBDeviceProvider>
                {
                    OpenRGBDeviceProvider.Instance,
                    WootingDeviceProvider.Instance
                };

                using RGBSurface surface = new RGBSurface();
                surface.RegisterUpdateTrigger(new TimerUpdateTrigger());

                foreach (IRGBDeviceProvider dp in deviceProviders)
                {
                    surface.Load(dp);
                }

                ListLedGroup    ledgroup = new ListLedGroup(surface, surface.Leds);
                RainbowGradient gradient = new RainbowGradient();
                gradient.AddDecorator(new MoveGradientDecorator(surface));
                ledgroup.Brush = new TextureBrush(new LinearGradientTexture(new Size(1, 1), gradient));

                foreach (IRGBDevice d in surface.Devices)
                {
                    Console.WriteLine($"Found {d.DeviceInfo.DeviceName}");
                }

                Console.ReadLine();
                surface?.Dispose();

                foreach (IRGBDeviceProvider dp in deviceProviders)
                {
                    dp.Dispose();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"Exception: {e}");
            }
        }
Exemplo n.º 26
0
        public static void Setup()
        {
            keyboard = CueSDK.KeyboardSDK;
            if (keyboard == null)
            {
                IsKeyboardCompatible = false;
                return;
            }

            HealthLedIDs = new List <CorsairLedId>()
            {
                CorsairLedId.D0,
                CorsairLedId.D1,
                CorsairLedId.D2,
                CorsairLedId.D3,
                CorsairLedId.D4,
                CorsairLedId.D5,
                CorsairLedId.D6,
                CorsairLedId.D7,
                CorsairLedId.D8,
                CorsairLedId.D9,
            };
            ManaLedIDs = new List <CorsairLedId>()
            {
                CorsairLedId.F1,
                CorsairLedId.F2,
                CorsairLedId.F3,
                CorsairLedId.F4,
                CorsairLedId.F5,
                CorsairLedId.F6,
                CorsairLedId.F7,
                CorsairLedId.F8,
                CorsairLedId.F9,
                CorsairLedId.F10,
                CorsairLedId.F11,
                CorsairLedId.F12,
            };

            HealthGroup = new ListLedGroup(keyboard, HealthLedIDs);
            ManaGroup   = new ListLedGroup(keyboard, ManaLedIDs);

            keyboard.Brush = (SolidColorBrush)CorsairColor.Transparent;
            keyboard.Update();
        }
        public SurfaceDeviceDetectInputViewModel(ArtemisDevice device, IInputService inputService, IMessageService messageService, IRgbService rgbService)
        {
            Device  = device;
            Title   = $"{Device.RgbDevice.DeviceInfo.DeviceName} - Detect input";
            IsMouse = Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Mouse;

            _inputService   = inputService;
            _messageService = messageService;
            _rgbService     = rgbService;
            _inputService.IdentifyDevice(Device);
            _inputService.DeviceIdentified += InputServiceOnDeviceIdentified;

            // Create a LED group way at the top
            _ledGroup = new ListLedGroup(_rgbService.Surface, Device.Leds.Select(l => l.RgbLed))
            {
                Brush  = new SolidColorBrush(new Color(255, 255, 0)),
                ZIndex = 999
            };
        }
Exemplo n.º 28
0
        public void UpdateGraphicsDecorator()
        {
            // Clean up the old background if present
            if (_background != null)
            {
                _background.RemoveAllDecorators();
                _background.Detach();
            }

            // Apply the application wide brush and decorator
            _background = new ListLedGroup(Surface.Leds)
            {
                Brush = new SolidColorBrush(new Color(255, 255, 255, 255))
            };
            GraphicsDecorator = new GraphicsDecorator(_background);
            _background.Brush.RemoveAllDecorators();

            _background.Brush.AddDecorator(GraphicsDecorator);
        }
Exemplo n.º 29
0
        private void UpdateLedGroup(ListLedGroup group, NotifyCollectionChangedEventArgs args)
        {
            if (args.Action == NotifyCollectionChangedAction.Reset)
            {
                List <Led> leds = group.GetLeds().ToList();
                group.RemoveLeds(leds);
            }
            else
            {
                if (args.NewItems != null)
                {
                    group.AddLeds(args.NewItems.Cast <SyncLed>().GetLeds());
                }

                if (args.OldItems != null)
                {
                    group.RemoveLeds(args.OldItems.Cast <SyncLed>().GetLeds());
                }
            }
        }
Exemplo n.º 30
0
        public override void Init()
        {
            base.Init();
            MovementGroup = AddGroup(CorsairLedId.W, CorsairLedId.A, CorsairLedId.S, CorsairLedId.D);
            ThrowGroup    = AddGroup(CorsairLedId.F);
            KeyManagers.Add(new MediaKeyManager());
            KeyManagers.Add(new TypeFlashKeyManager()
            {
                AppliedKeys = MovementGroup.GetLeds(),
                FlashColor  = FromArgb(0xFF00FFFF),
            });
            ListLedGroup FlashyKeysGroup = AddFlashyKeysGroup();

            FlashyKeysGroup.RemoveLeds(MovementGroup.GetLeds());
            KeyManagers.Add(new TypeFlashKeyManager()
            {
                AppliedKeys = FlashyKeysGroup.GetLeds()
            });
            KeyManagers.Add(new ModifierKeyManager());
        }
Exemplo n.º 31
0
        public override void Init()
        {
            base.Init();
            FunctionGroup = AddGroup(CorsairLedId.Escape, CorsairLedId.GraveAccentAndTilde, CorsairLedId.Tab,
                                     CorsairLedId.F4, CorsairLedId.F5, CorsairLedId.F6, CorsairLedId.F7, CorsairLedId.F9, CorsairLedId.F12,
                                     CorsairLedId.LeftShift, CorsairLedId.LeftCtrl, CorsairLedId.LeftAlt);
            HotbarGroup         = AddGroup(CorsairLedId.D1, CorsairLedId.D2, CorsairLedId.D3, CorsairLedId.D4, CorsairLedId.D5, CorsairLedId.X);
            BrushSizeGroup      = AddGroup(CorsairLedId.KeypadPlus, CorsairLedId.KeypadMinus);
            MovementGroup       = AddGroup(CorsairLedId.W, CorsairLedId.A, CorsairLedId.S, CorsairLedId.D);
            ItemsGroup          = AddGroup(CorsairLedId.E, CorsairLedId.F, CorsairLedId.Z);
            WeaponsGroup        = AddGroup(CorsairLedId.Q, CorsairLedId.C, CorsairLedId.Space);
            VehiclesGroup       = AddGroup(CorsairLedId.G, CorsairLedId.V, CorsairLedId.Enter);
            TechMapProdGroup    = AddGroup(CorsairLedId.T, CorsairLedId.M, CorsairLedId.P, CorsairLedId.K, CorsairLedId.L);
            RotateGroup         = AddGroup(CorsairLedId.R);
            ShootingEffectGroup = AddGroup(Keyboard.GetLeds());
            ShootingEffectGroup.RemoveLed(CorsairLedId.Brightness, CorsairLedId.WinLock, CorsairLedId.Mute,
                                          CorsairLedId.Stop, CorsairLedId.ScanPreviousTrack, CorsairLedId.PlayPause, CorsairLedId.ScanNextTrack);
            KeyManagers.Add(new MediaKeyManager());
            KeyManagers.Add(new TypeFlashKeyManager()
            {
                AppliedKeys = MovementGroup.GetLeds(),
                FlashColor  = FromArgb(0xFF00FFFF),
            });
            //KeyManagers.Add(new ModifierKeyManager());
            ListLedGroup FlashyKeysGroup = AddFlashyKeysGroup();

            FlashyKeysGroup.RemoveLeds(MovementGroup.GetLeds());
            FlashyKeysGroup.AddLed(CorsairLedId.LeftAlt);
            KeyManagers.Add(new TypeFlashKeyManager()
            {
                AppliedKeys = FlashyKeysGroup.GetLeds()
            });
            KeyManagers.Add(new ModifierKeyManager()
            {
                Leds = new CorsairLedId[]
                {
                    CorsairLedId.LeftShift, CorsairLedId.LeftCtrl, CorsairLedId.LeftGui,
                    CorsairLedId.RightShift, CorsairLedId.RightCtrl, CorsairLedId.RightAlt, CorsairLedId.RightGui
                }
            });
        }