mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 21:16:24 +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.Logitech
|
||||
/// <summary>
|
||||
/// Represents a logitech RGB-device.
|
||||
/// </summary>
|
||||
internal interface ILogitechRGBDevice : IRGBDevice
|
||||
{
|
||||
void Initialize(UpdateQueue updateQueue);
|
||||
}
|
||||
public interface ILogitechRGBDevice : IRGBDevice
|
||||
{ }
|
||||
}
|
||||
@@ -3,60 +3,21 @@
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
|
||||
/// <inheritdoc cref="ILogitechRGBDevice" />
|
||||
/// <summary>
|
||||
/// Represents a generic Logitech-device. (keyboard, mouse, headset, mousepad).
|
||||
/// </summary>
|
||||
public abstract class LogitechRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, ILogitechRGBDevice
|
||||
where TDeviceInfo : LogitechRGBDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Gets information about the <see cref="T:RGB.NET.Devices.Logitech.LogitechRGBDevice" />.
|
||||
/// </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="LogitechRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by Logitech for the device.</param>
|
||||
protected LogitechRGBDevice(TDeviceInfo info)
|
||||
{
|
||||
this.DeviceInfo = info;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the device.
|
||||
/// </summary>
|
||||
public virtual void Initialize(UpdateQueue updateQueue)
|
||||
{
|
||||
UpdateQueue = updateQueue;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
{
|
||||
try { UpdateQueue?.Dispose(); }
|
||||
catch { /* at least we tried */ }
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
protected LogitechRGBDevice(TDeviceInfo info, IUpdateQueue updateQueue)
|
||||
: base(info, updateQueue)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user