using System.Collections.Generic; using RGB.NET.Core; using RGB.NET.Devices.Wooting.Enum; using RGB.NET.Devices.Wooting.Generic; namespace RGB.NET.Devices.Wooting.Keyboard { /// /// /// Represents a Wooting keyboard. /// public class WootingKeyboardRGBDevice : WootingRGBDevice, IKeyboard { #region Properties & Fields IKeyboardDeviceInfo IKeyboard.DeviceInfo => DeviceInfo; #endregion #region Constructors /// /// /// Initializes a new instance of the class. /// /// The specific information provided by Wooting for the keyboard /// The update trigger used to update this device. internal WootingKeyboardRGBDevice(WootingKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger) : base(info, updateTrigger) { InitializeLayout(); } #endregion #region Methods private void InitializeLayout() { Dictionary mapping = WootingKeyboardLedMappings.Mapping[DeviceInfo.WootingDeviceType]; foreach (KeyValuePair led in mapping) AddLed(led.Key, new Point(led.Value.column * 19, led.Value.row * 19), new Size(19, 19)); } /// protected override object GetLedCustomData(LedId ledId) => WootingKeyboardLedMappings.Mapping[DeviceInfo.WootingDeviceType][ledId]; /// protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate)); #endregion } }