diff --git a/RGB.NET.Devices.Wooting/Enum/WootingLogicalKeyboardLayout.cs b/RGB.NET.Devices.Wooting/Enum/WootingLogicalKeyboardLayout.cs
index f21929d..59976fb 100644
--- a/RGB.NET.Devices.Wooting/Enum/WootingLogicalKeyboardLayout.cs
+++ b/RGB.NET.Devices.Wooting/Enum/WootingLogicalKeyboardLayout.cs
@@ -11,6 +11,6 @@ namespace RGB.NET.Devices.Wooting.Enum
public enum WootingLogicalKeyboardLayout
{
US = 0,
- EU = 1
+ UK = 1
};
}
diff --git a/RGB.NET.Devices.Wooting/Enum/WootingPhysicalKeyboardLayout.cs b/RGB.NET.Devices.Wooting/Enum/WootingPhysicalKeyboardLayout.cs
index 2142d50..2b37cbf 100644
--- a/RGB.NET.Devices.Wooting/Enum/WootingPhysicalKeyboardLayout.cs
+++ b/RGB.NET.Devices.Wooting/Enum/WootingPhysicalKeyboardLayout.cs
@@ -11,6 +11,6 @@ namespace RGB.NET.Devices.Wooting.Enum
public enum WootingPhysicalKeyboardLayout
{
US = 0,
- EU = 1
+ UK = 1
}
}
diff --git a/RGB.NET.Devices.Wooting/Generic/IWootingRGBDevice.cs b/RGB.NET.Devices.Wooting/Generic/IWootingRGBDevice.cs
index 42c6995..b7356eb 100644
--- a/RGB.NET.Devices.Wooting/Generic/IWootingRGBDevice.cs
+++ b/RGB.NET.Devices.Wooting/Generic/IWootingRGBDevice.cs
@@ -7,6 +7,6 @@ namespace RGB.NET.Devices.Wooting.Generic
///
internal interface IWootingRGBDevice : IRGBDevice
{
- void Initialize(UpdateQueue updateQueue);
+ void Initialize(IDeviceUpdateTrigger updateTrigger);
}
}
diff --git a/RGB.NET.Devices.Wooting/Generic/WootingRGBDevice.cs b/RGB.NET.Devices.Wooting/Generic/WootingRGBDevice.cs
index 6fd6af7..7647a3d 100644
--- a/RGB.NET.Devices.Wooting/Generic/WootingRGBDevice.cs
+++ b/RGB.NET.Devices.Wooting/Generic/WootingRGBDevice.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using System.Linq;
using RGB.NET.Core;
-using RGB.NET.Devices.Wooting.Native;
namespace RGB.NET.Devices.Wooting.Generic
{
@@ -44,11 +41,11 @@ namespace RGB.NET.Devices.Wooting.Generic
#endregion
#region Methods
-
+
///
/// Initializes the device.
///
- public void Initialize(UpdateQueue updateQueue)
+ public void Initialize(IDeviceUpdateTrigger updateTrigger)
{
InitializeLayout();
@@ -58,7 +55,7 @@ namespace RGB.NET.Devices.Wooting.Generic
Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y);
}
- UpdateQueue = updateQueue;
+ UpdateQueue = new WootingUpdateQueue(updateTrigger);
}
///
diff --git a/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs b/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs
new file mode 100644
index 0000000..8342768
--- /dev/null
+++ b/RGB.NET.Devices.Wooting/Generic/WootingUpdateQueue.cs
@@ -0,0 +1,42 @@
+using System.Collections.Generic;
+using RGB.NET.Core;
+using RGB.NET.Devices.Wooting.Native;
+
+namespace RGB.NET.Devices.Wooting.Generic
+{
+ ///
+ ///
+ /// Represents the update-queue performing updates for cooler master devices.
+ ///
+ public class WootingUpdateQueue : UpdateQueue
+ {
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The update trigger used by this queue.
+ public WootingUpdateQueue(IDeviceUpdateTrigger updateTrigger)
+ : base(updateTrigger)
+ {
+ }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ protected override void Update(Dictionary
- public static List PossibleX86NativePaths { get; } = new List { "x86/wooting-rgb-sdk.dll" };
+ public static List PossibleX86NativePaths { get; } = new List {"x86/wooting-rgb-sdk.dll"};
///
/// Gets a modifiable list of paths used to find the native SDK-dlls for x64 applications.
/// The first match will be used.
///
- public static List PossibleX64NativePaths { get; } = new List { "x64/wooting-rgb-sdk64.dll" };
+ public static List PossibleX64NativePaths { get; } = new List {"x64/wooting-rgb-sdk64.dll"};
///
///
@@ -52,6 +55,11 @@ namespace RGB.NET.Devices.Wooting
///
public IEnumerable Devices { get; private set; }
+ ///
+ /// The used to trigger the updates for cooler master devices.
+ ///
+ public DeviceUpdateTrigger UpdateTrigger { get; private set; }
+
#endregion
#region Constructors
@@ -62,8 +70,11 @@ namespace RGB.NET.Devices.Wooting
/// Thrown if this constructor is called even if there is already an instance of this class.
public WootingDeviceProvider()
{
- if (_instance != null) throw new InvalidOperationException($"There can be only one instance of type {nameof(WootingDeviceProvider)}");
+ if (_instance != null)
+ throw new InvalidOperationException($"There can be only one instance of type {nameof(WootingDeviceProvider)}");
_instance = this;
+
+ UpdateTrigger = new DeviceUpdateTrigger();
}
#endregion
@@ -72,26 +83,45 @@ namespace RGB.NET.Devices.Wooting
///
/// Thrown if the SDK failed to initialize
- public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false, bool throwExceptions = false)
+ public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false,
+ bool throwExceptions = false)
{
IsInitialized = false;
try
{
+ UpdateTrigger?.Stop();
+
_WootingSDK.Reload();
IList devices = new List();
if (_WootingSDK.KeyboardConnected())
{
- if (_WootingSDK.IsWootingOne())
+ IWootingRGBDevice device;
+ // TODO: Find an accurate way to determine physical and logical layouts
+ if (_WootingSDK.IsWootingTwo())
{
-
- }
- else if (_WootingSDK.IsWootingTwo())
- {
-
+ device = new WootingKeyboardRGBDevice(new WootingKeyboardRGBDeviceInfo(WootingDevicesIndexes.WootingTwo,
+ WootingPhysicalKeyboardLayout.US,
+ CultureHelper.GetCurrentCulture()));
}
+ else if (_WootingSDK.IsWootingOne())
+ {
+ device = new WootingKeyboardRGBDevice(new WootingKeyboardRGBDeviceInfo(WootingDevicesIndexes.WootingOne,
+ WootingPhysicalKeyboardLayout.US,
+ CultureHelper.GetCurrentCulture()));
+ }
+ else
+ {
+ throw new RGBDeviceException("No supported Wooting keyboard connected");
+ }
+
+ device.Initialize(UpdateTrigger);
+ devices.Add(device);
}
+
+ UpdateTrigger?.Start();
+
Devices = new ReadOnlyCollection(devices);
IsInitialized = true;
}
@@ -112,7 +142,9 @@ namespace RGB.NET.Devices.Wooting
public void Dispose()
{
try { _WootingSDK.Reset(); }
- catch { /* Unlucky.. */}
+ catch
+ { /* Unlucky.. */
+ }
}
#endregion