1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 17:48:31 +00:00

Changed DevicesChangedEventArgs to only contain the device causing the change and an enum indicatin what happened

This commit is contained in:
Darth Affe 2023-05-15 22:45:28 +02:00
parent 4684e29610
commit b90c47076a

View File

@ -6,25 +6,31 @@ public sealed class DevicesChangedEventArgs : EventArgs
{
#region Properties & Fields
public IRGBDevice? Added { get; }
public IRGBDevice? Removed { get; }
public IRGBDevice Device { get; }
public DevicesChangedAction Action { get; }
#endregion
#region Constructors
private DevicesChangedEventArgs(IRGBDevice? added, IRGBDevice? removed)
public DevicesChangedEventArgs(IRGBDevice device, DevicesChangedAction action)
{
this.Added = added;
this.Removed = removed;
this.Device = device;
this.Action = action;
}
#endregion
#region Methods
public static DevicesChangedEventArgs CreateDevicesAddedArgs(IRGBDevice addedDevice) => new(addedDevice, null);
public static DevicesChangedEventArgs CreateDevicesRemovedArgs(IRGBDevice removedDevice) => new(null, removedDevice);
public static DevicesChangedEventArgs CreateDevicesAddedArgs(IRGBDevice addedDevice) => new(addedDevice, DevicesChangedAction.Added);
public static DevicesChangedEventArgs CreateDevicesRemovedArgs(IRGBDevice removedDevice) => new(removedDevice, DevicesChangedAction.Removed);
#endregion
public enum DevicesChangedAction
{
Added,
Removed
}
}