Exemplo n.º 1
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.º 2
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.º 3
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.º 4
0
        private void BlinkDevice(ArtemisDevice device, int blinkCount)
        {
            // Create a LED group way at the top
            ListLedGroup ledGroup = new ListLedGroup(device.Leds.Select(l => l.RgbLed))
            {
                Brush  = new SolidColorBrush(new Color(255, 255, 255)),
                ZIndex = 999
            };

            // After 200ms, detach the LED group
            Task.Run(async() =>
            {
                await Task.Delay(200);
                ledGroup.Detach();

                if (blinkCount < 5)
                {
                    // After another 200ms, start over, repeat six times
                    await Task.Delay(200);
                    BlinkDevice(device, blinkCount + 1);
                }
            });
        }
 public override void OnDialogClosed(object sender, DialogClosingEventArgs e)
 {
     base.OnDialogClosed(sender, e);
     _inputService.DeviceIdentified -= InputServiceOnDeviceIdentified;
     _ledGroup.Detach();
 }
Exemplo n.º 6
0
        private void LoadDevices()
        {
            RGBDeviceType deviceMask = RGBDeviceType.None;

            if (_config.Model.rgbDeviceSettings.useKeyboards)
            {
                deviceMask |= RGBDeviceType.Keyboard;
            }
            if (_config.Model.rgbDeviceSettings.useMice)
            {
                deviceMask |= RGBDeviceType.Mouse;
            }
            if (_config.Model.rgbDeviceSettings.useMotherboard)
            {
                deviceMask |= RGBDeviceType.Mainboard;
            }
            Console.WriteLine("Loading rgb devices...");
            if (!CorsairDeviceProvider.Instance.IsInitialized)
            {
                CorsairDeviceProvider.Instance.Initialize(deviceMask, throwExceptions: true);
            }
            CorsairDeviceProvider.Instance.Exception += Instance_Exception;
            _surface.Load(CorsairDeviceProvider.Instance, deviceMask, throwExceptions: true);

            //razer sdk may not exist because it has to be in system directories.
            try
            {
                if (!RazerDeviceProvider.Instance.IsInitialized)
                {
                    RazerDeviceProvider.Instance.Initialize(deviceMask, throwExceptions: true);
                }
                RazerDeviceProvider.Instance.Exception += Instance_Exception;
                _surface.Load(RazerDeviceProvider.Instance, deviceMask, throwExceptions: true);
            }
            catch { }

            if (!LogitechDeviceProvider.Instance.IsInitialized)
            {
                LogitechDeviceProvider.Instance.Initialize(deviceMask, throwExceptions: true);
            }
            LogitechDeviceProvider.Instance.Exception += Instance_Exception;
            _surface.Load(LogitechDeviceProvider.Instance, deviceMask, throwExceptions: true);

            if (!AsusDeviceProvider.Instance.IsInitialized)
            {
                AsusDeviceProvider.Instance.Initialize(deviceMask, throwExceptions: true);
            }
            AsusDeviceProvider.Instance.Exception += Instance_Exception;
            _surface.Load(AsusDeviceProvider.Instance, deviceMask, throwExceptions: true);
            _surface.AlignDevices();

            foreach (var device in _surface.Devices)
            {
                var group = new ListLedGroup(device.Surface)
                {
                    Brush = new SolidColorBrush(RGBConsts.Black)
                };
                _surface.Update();
                group.Detach();
            }
        }