Example #1
0
 public static ListLedGroup GetSingleLedGroup(ICueDevice device, CorsairLedId ledId)
 {
     if (!SingleLedGroups.ContainsKey(ledId))
     {
         SingleLedGroups.Add(ledId, new ListLedGroup(device, ledId));
     }
     return(SingleLedGroups[ledId]);
 }
Example #2
0
        internal DeviceInput(ICueDevice cueDevice)
        {
            this._cueDevice = cueDevice;

            if (_bitMasks == null)
            {
                GenerateInputBitMasks();
            }
        }
        /// <summary>
        ///   Initializes a new instance of the <see cref="AbstractLedGroup" /> class.
        /// </summary>
        /// <param name="device">The device this ledgroup belongs to.</param>
        /// <param name="autoAttach">Specifies whether this group should be automatically attached or not.</param>
        protected AbstractLedGroup(ICueDevice device, bool autoAttach = true)
        {
            Device = device;

            if (autoAttach)
            {
                this.Attach();
            }
        }
        private static IDeviceInput GetOrCreateDeviceInput(ICueDevice cueDevice)
        {
            IDeviceInput deviceInput;

            if (!_deviceInputMapping.TryGetValue(cueDevice, out deviceInput))
            {
                _deviceInputMapping.Add(cueDevice, (deviceInput = new DeviceInput(cueDevice)));
            }
            return(deviceInput);
        }
Example #5
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;
        }
 /// <summary>
 /// Gets an array of <see cref="CorsairLedId"/> containing all currencly ledIds considered <see cref="CUE.NET.Input.Enums.InputAction.Pressed"/>.
 /// </summary>
 /// <param name="cueDevice">The <see cref="ICueDevice"/> to get the active inputs from.</param>
 /// <returns>An array of <see cref="CorsairLedId"/> containing all currencly ledIds considered <see cref="CUE.NET.Input.Enums.InputAction.Pressed"/>.</returns>
 public static CorsairLedId[] GetActiveInputs(this ICueDevice cueDevice)
 {
     return(GetOrCreateDeviceInput(cueDevice).ActiveInputs);
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="autoAttach">Specifies whether this ledgroup should be automatically attached or not.</param>
 /// <param name="leds">The initial LEDs of this ledgroup.</param>
 public ListLedGroup(ICueDevice device, bool autoAttach, IEnumerable<CorsairLed> leds)
     : base(device, autoAttach)
 {
     AddLeds(leds);
 }
Example #8
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="ListLedGroup" /> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="leds">The IDs of the initial LEDs of this ledgroup.</param>
 public ListLedGroup(ICueDevice device, IEnumerable <CorsairLedId> leds) : this(device, true, leds)
 {
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="leds">The IDs of the initial LEDs of this ledgroup.</param>
 public ListLedGroup(ICueDevice device, params CorsairLedId[] leds)
     : this(device, true, leds)
 { }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="rectangle">The rectangle of this ledgroup.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a LED must have with the <see cref="Rectangle" /> to be taken into the ledgroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleLedGroup(ICueDevice device, RectangleF rectangle, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : base(device, autoAttach)
 {
     this.Rectangle = rectangle;
     this.MinOverlayPercentage = minOverlayPercentage;
 }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="fromLed">They first LED to calculate the rectangle of this ledgroup from.</param>
 /// <param name="toLed">They second LED to calculate the rectangle of this ledgroup from.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a LED must have with the <see cref="Rectangle" /> to be taken into the ledgroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleLedGroup(ICueDevice device, CorsairLed fromLed, CorsairLed toLed, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : this(device, RectangleHelper.CreateRectangleFromRectangles(fromLed.LedRectangle, toLed.LedRectangle), minOverlayPercentage, autoAttach)
 { }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="fromLed">They ID of the first LED to calculate the rectangle of this ledgroup from.</param>
 /// <param name="toLed">They ID of the second LED to calculate the rectangle of this ledgroup from.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a LED must have with the <see cref="Rectangle" /> to be taken into the ledgroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleLedGroup(ICueDevice device, CorsairLedId fromLed, CorsairLedId toLed, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : this(device, device[fromLed], device[toLed], minOverlayPercentage, autoAttach)
 {
 }
Example #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="rectangle">The rectangle of this ledgroup.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a LED must have with the <see cref="Rectangle" /> to be taken into the ledgroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleLedGroup(ICueDevice device, RectangleF rectangle, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : base(device, autoAttach)
 {
     this.Rectangle            = rectangle;
     this.MinOverlayPercentage = minOverlayPercentage;
 }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CorsairLed"/> class.
 /// </summary>
 /// <param name="device">The <see cref="ICueDevice"/> the <see cref="CorsairLed"/> is associated with.</param>
 /// <param name="id">The <see cref="CorsairLedId"/> of the <see cref="CorsairLed"/>.</param>
 /// <param name="ledRectangle">The rectangle representing the physical location of the <see cref="CorsairLed"/>.</param>
 internal CorsairLed(ICueDevice device, CorsairLedId id, RectangleF ledRectangle)
 {
     this.Device       = device;
     this.Id           = id;
     this.LedRectangle = ledRectangle;
 }
Example #15
0
 public ReactiveTypingEffect(ICueDevice observedDevice)
 {
     this._observedDevice = observedDevice;
 }
Example #16
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;
        }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="leds">The IDs of the initial LEDs of this ledgroup.</param>
 public ListLedGroup(ICueDevice device, IEnumerable<CorsairLedId> leds)
     : this(device, true, leds)
 { }
Example #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="fromLed">They first LED to calculate the rectangle of this ledgroup from.</param>
 /// <param name="toLed">They second LED to calculate the rectangle of this ledgroup from.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a LED must have with the <see cref="Rectangle" /> to be taken into the ledgroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleLedGroup(ICueDevice device, CorsairLed fromLed, CorsairLed toLed, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : this(device, RectangleHelper.CreateRectangleFromRectangles(fromLed.LedRectangle, toLed.LedRectangle), minOverlayPercentage, autoAttach)
 {
 }
Example #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="fromPoint">They first point to calculate the rectangle of this ledgroup from.</param>
 /// <param name="toPoint">They second point to calculate the rectangle of this ledgroup from.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a LED must have with the <see cref="Rectangle" /> to be taken into the ledgroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleLedGroup(ICueDevice device, PointF fromPoint, PointF toPoint, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : this(device, RectangleHelper.CreateRectangleFromPoints(fromPoint, toPoint), minOverlayPercentage, autoAttach)
 {
 }
Example #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="fromLed">They ID of the first LED to calculate the rectangle of this ledgroup from.</param>
 /// <param name="toLed">They ID of the second LED to calculate the rectangle of this ledgroup from.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a LED must have with the <see cref="Rectangle" /> to be taken into the ledgroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleLedGroup(ICueDevice device, CorsairLedId fromLed, CorsairLedId toLed, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : this(device, device[fromLed], device[toLed], minOverlayPercentage, autoAttach)
 { }
Example #21
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="ListLedGroup" /> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="autoAttach">Specifies whether this ledgroup should be automatically attached or not.</param>
 public ListLedGroup(ICueDevice device, bool autoAttach = true) : base(device, autoAttach)
 {
 }
Example #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="fromPoint">They first point to calculate the rectangle of this ledgroup from.</param>
 /// <param name="toPoint">They second point to calculate the rectangle of this ledgroup from.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a LED must have with the <see cref="Rectangle" /> to be taken into the ledgroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleLedGroup(ICueDevice device, PointF fromPoint, PointF toPoint, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : this(device, RectangleHelper.CreateRectangleFromPoints(fromPoint, toPoint), minOverlayPercentage, autoAttach)
 { }
Example #23
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="ListLedGroup" /> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="autoAttach">Specifies whether this ledgroup should be automatically attached or not.</param>
 /// <param name="leds">The initial LEDs of this ledgroup.</param>
 public ListLedGroup(ICueDevice device, bool autoAttach, params CorsairLed[] leds) : base(device, autoAttach)
 {
     AddLeds(leds);
 }
Example #24
0
 internal HIDInputLoop(ICueDevice cueDevice)
 {
     this._cueDevice = cueDevice;
 }
Example #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="autoAttach">Specifies whether this ledgroup should be automatically attached or not.</param>
 /// <param name="leds">The initial LEDs of this ledgroup.</param>
 public ListLedGroup(ICueDevice device, bool autoAttach, params CorsairLed[] leds)
     : base(device, autoAttach)
 {
     AddLeds(leds);
 }
Example #26
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="ListLedGroup" /> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="autoAttach">Specifies whether this ledgroup should be automatically attached or not.</param>
 /// <param name="leds">The initial LEDs of this ledgroup.</param>
 public ListLedGroup(ICueDevice device, bool autoAttach, IEnumerable <CorsairLed> leds) : base(device, autoAttach)
 {
     AddLeds(leds);
 }
Example #27
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="CorsairLed" /> class.
 /// </summary>
 /// <param name="device">The <see cref="ICueDevice" /> the <see cref="CorsairLed" /> is associated with.</param>
 /// <param name="id">The <see cref="CorsairLedId" /> of the <see cref="CorsairLed" />.</param>
 /// <param name="ledRectangle">The rectangle representing the physical location of the <see cref="CorsairLed" />.</param>
 internal CorsairLed(ICueDevice device, CorsairLedId id, RectangleF ledRectangle)
 {
     Device       = device;
     Id           = id;
     LedRectangle = ledRectangle;
 }
Example #28
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="ListLedGroup" /> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="leds">The IDs of the initial LEDs of this ledgroup.</param>
 public ListLedGroup(ICueDevice device, params CorsairLedId[] leds) : this(device, true, leds)
 {
 }
        /// <summary>
        /// Unregisters an eventhandler on the device to stop beeing notified about input.
        /// </summary>
        /// <param name="cueDevice">The <see cref="ICueDevice"/> the eventhandler should be unregistered from.</param>
        /// <param name="eventHandler">The eventhandler to unregister.</param>
        public static void UnregisterOnInput(this ICueDevice cueDevice, EventHandler <OnInputEventArgs> eventHandler)
        {
            IDeviceInput deviceInput = GetOrCreateDeviceInput(cueDevice);

            deviceInput.UnregisterEventHandler(eventHandler);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OnInputEventArgs"/> class.
 /// </summary>
 /// <param name="device">The <see cref="ICueDevice"/> on which the event occured.</param>
 /// <param name="ledId">The <see cref="CorsairLedId"/> of the key that performed the action.</param>
 /// <param name="action">The <see cref="InputAction"/> performed by the key.</param>
 public OnInputEventArgs(ICueDevice device, CorsairLedId ledId, InputAction action)
 {
     this.Device = device;
     this.LedId  = ledId;
     this.Action = action;
 }
Example #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListLedGroup"/> class.
 /// </summary>
 /// <param name="device">The device this ledgroup belongs to.</param>
 /// <param name="autoAttach">Specifies whether this ledgroup should be automatically attached or not.</param>
 public ListLedGroup(ICueDevice device, bool autoAttach = true)
     : base(device, autoAttach)
 { }