mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 04:57:15 +00:00
Streamlined device loading/handling in device providers
This commit is contained in:
1 parent
f6f3e9185c
commit
2a9a43683c
81 files changed
+867
-1864
No files matched your search
@@ -5,8 +5,6 @@ namespace RGB.NET.Devices.Wooting.Generic
|
||||
/// <summary>
|
||||
/// Represents a Wooting RGB-device.
|
||||
/// </summary>
|
||||
internal interface IWootingRGBDevice : IRGBDevice
|
||||
{
|
||||
void Initialize(IDeviceUpdateTrigger updateTrigger);
|
||||
}
|
||||
public interface IWootingRGBDevice : IRGBDevice
|
||||
{ }
|
||||
}
|
||||
@@ -10,60 +10,15 @@ namespace RGB.NET.Devices.Wooting.Generic
|
||||
public abstract class WootingRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, IWootingRGBDevice
|
||||
where TDeviceInfo : WootingRGBDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Gets information about the <see cref="T:RGB.NET.Devices.Wooting.WootingRGBDevice" />.
|
||||
/// </summary>
|
||||
public override TDeviceInfo DeviceInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the update queue performing updates for this device.
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
protected UpdateQueue? UpdateQueue { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WootingRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by Wooting for the device.</param>
|
||||
protected WootingRGBDevice(TDeviceInfo info)
|
||||
{
|
||||
this.DeviceInfo = info;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the device.
|
||||
/// </summary>
|
||||
public void Initialize(IDeviceUpdateTrigger updateTrigger)
|
||||
{
|
||||
InitializeLayout();
|
||||
|
||||
UpdateQueue = new WootingUpdateQueue(updateTrigger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the <see cref="Led"/> and <see cref="Size"/> of the device.
|
||||
/// </summary>
|
||||
protected abstract void InitializeLayout();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
{
|
||||
try { UpdateQueue?.Dispose(); }
|
||||
catch { /* at least we tried */ }
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
protected WootingRGBDevice(TDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new WootingUpdateQueue(updateTrigger))
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user