Example #1
0
        /// <summary>
        /// Initializes the device.
        /// </summary>
        public void Initialize(CorsairDeviceUpdateQueue deviceUpdateQueue)
        {
            DeviceUpdateQueue = deviceUpdateQueue;

            InitializeLayout();

            foreach (Led led in LedMapping.Values)
            {
                CorsairLedId ledId = (CorsairLedId)led.CustomData;
                if (ledId != CorsairLedId.Invalid)
                {
                    InternalLedMapping.Add(ledId, led);
                }
            }

            if (Size == Size.Invalid)
            {
                Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle));
                Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y);
            }
        }
Example #2
0
 /// <summary>
 /// Gets the <see cref="Led"/> with the specified <see cref="CorsairLedId"/>.
 /// </summary>
 /// <param name="ledId">The <see cref="CorsairLedId"/> of the <see cref="Led"/> to get.</param>
 /// <returns>The <see cref="Led"/> with the specified <see cref="CorsairLedId"/> or null if no <see cref="Led"/> is found.</returns>
 // ReSharper disable once MemberCanBePrivate.Global
 public Led this[CorsairLedId ledId] => InternalLedMapping.TryGetValue(ledId, out Led led) ? led : null;