diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs
index 0fc40cb..7be5ab0 100644
--- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs
+++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs
@@ -20,10 +20,20 @@ namespace RGB.NET.Core
///
public Size Size => new Size(InternalSize?.Width ?? 0, InternalSize?.Height ?? 0);
+ private Size _internalSize;
///
/// Gets the of the whole .
///
- protected abstract Size InternalSize { get; set; }
+ protected Size InternalSize
+ {
+ get { return _internalSize; }
+ set
+ {
+ // ReSharper disable once ExplicitCallerInfoArgument
+ if (SetProperty(ref _internalSize, value))
+ OnPropertyChanged(nameof(Size));
+ }
+ }
private Point _location = new Point();
///
diff --git a/RGB.NET.Core/Devices/IRGBDeviceInfo.cs b/RGB.NET.Core/Devices/IRGBDeviceInfo.cs
index 6575570..115d307 100644
--- a/RGB.NET.Core/Devices/IRGBDeviceInfo.cs
+++ b/RGB.NET.Core/Devices/IRGBDeviceInfo.cs
@@ -1,4 +1,6 @@
-namespace RGB.NET.Core
+using System;
+
+namespace RGB.NET.Core
{
///
/// Represents a generic information for a
@@ -22,9 +24,10 @@
///
string Model { get; }
- #endregion
-
- #region Methods
+ ///
+ /// Gets the URI of an image of the or null if there is no image.
+ ///
+ Uri Image { get; }
#endregion
}
diff --git a/RGB.NET.Core/Events/SurfaceLayoutChangedEventArgs.cs b/RGB.NET.Core/Events/SurfaceLayoutChangedEventArgs.cs
index e4f03b2..3a94aa7 100644
--- a/RGB.NET.Core/Events/SurfaceLayoutChangedEventArgs.cs
+++ b/RGB.NET.Core/Events/SurfaceLayoutChangedEventArgs.cs
@@ -2,6 +2,7 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global
using System;
+using System.Collections.Generic;
namespace RGB.NET.Core
{
@@ -15,7 +16,7 @@ namespace RGB.NET.Core
///
/// Gets the that caused the change. Returns null if the change isn't caused by a .
///
- public IRGBDevice Device { get; }
+ public IEnumerable Devices { get; }
///
/// Gets a value indicating if the event is caused by the addition of a new to the .
@@ -34,12 +35,12 @@ namespace RGB.NET.Core
///
/// Initializes a new instance of the class.
///
- /// The that caused the change
+ /// The that caused the change.
/// A value indicating if the event is caused by the addition of a new to the .
/// A value indicating if the event is caused by a changed location of one of the devices on the .
- public SurfaceLayoutChangedEventArgs(IRGBDevice device, bool deviceAdded, bool deviceLocationChanged)
+ public SurfaceLayoutChangedEventArgs(IEnumerable devices, bool deviceAdded, bool deviceLocationChanged)
{
- this.Device = device;
+ this.Devices = devices;
this.DeviceAdded = deviceAdded;
this.DeviceLocationChanged = deviceLocationChanged;
}
diff --git a/RGB.NET.Core/Leds/Led.cs b/RGB.NET.Core/Leds/Led.cs
index eb05323..42479e1 100644
--- a/RGB.NET.Core/Leds/Led.cs
+++ b/RGB.NET.Core/Leds/Led.cs
@@ -116,6 +116,8 @@ namespace RGB.NET.Core
internal void Update()
{
_color = RequestedColor;
+ // ReSharper disable once ExplicitCallerInfoArgument
+ OnPropertyChanged(nameof(Color));
}
///
@@ -126,6 +128,9 @@ namespace RGB.NET.Core
_color = Color.Transparent;
RequestedColor = Color.Transparent;
IsLocked = false;
+
+ // ReSharper disable once ExplicitCallerInfoArgument
+ OnPropertyChanged(nameof(Color));
}
#endregion
diff --git a/RGB.NET.Core/RGBSurfaceDeviceLoader.cs b/RGB.NET.Core/RGBSurfaceDeviceLoader.cs
index 844a88c..f7ed23f 100644
--- a/RGB.NET.Core/RGBSurfaceDeviceLoader.cs
+++ b/RGB.NET.Core/RGBSurfaceDeviceLoader.cs
@@ -1,4 +1,5 @@
-using System.ComponentModel;
+using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
namespace RGB.NET.Core
@@ -16,7 +17,7 @@ namespace RGB.NET.Core
{
if (_deviceProvider.Contains(deviceProvider) || _deviceProvider.Any(x => x.GetType() == deviceProvider.GetType())) return;
- IRGBDevice addedDevice = null;
+ List addedDevices = new List();
if (deviceProvider.IsInitialized || deviceProvider.Initialize())
{
_deviceProvider.Add(deviceProvider);
@@ -25,7 +26,7 @@ namespace RGB.NET.Core
{
if (_devices.Contains(device)) continue;
- addedDevice = device;
+ addedDevices.Add(device);
device.PropertyChanged += DeviceOnPropertyChanged;
device.Location.PropertyChanged += DeviceLocationOnPropertyChanged;
@@ -33,10 +34,10 @@ namespace RGB.NET.Core
}
}
- if (addedDevice != null)
+ if (addedDevices.Any())
{
UpdateSurfaceRectangle();
- SurfaceLayoutChanged?.Invoke(new SurfaceLayoutChangedEventArgs(addedDevice, true, false));
+ SurfaceLayoutChanged?.Invoke(new SurfaceLayoutChangedEventArgs(addedDevices, true, false));
}
}
@@ -44,8 +45,8 @@ namespace RGB.NET.Core
{
if (string.Equals(propertyChangedEventArgs.PropertyName, nameof(IRGBDevice.Location)))
{
- SurfaceLayoutChanged?.Invoke(new SurfaceLayoutChangedEventArgs(sender as IRGBDevice, false, true));
UpdateSurfaceRectangle();
+ SurfaceLayoutChanged?.Invoke(new SurfaceLayoutChangedEventArgs(new[] { sender as IRGBDevice }, false, true));
((IRGBDevice)sender).Location.PropertyChanged += DeviceLocationOnPropertyChanged;
}
@@ -53,8 +54,8 @@ namespace RGB.NET.Core
private static void DeviceLocationOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
{
- SurfaceLayoutChanged?.Invoke(new SurfaceLayoutChangedEventArgs(sender as IRGBDevice, false, true));
UpdateSurfaceRectangle();
+ SurfaceLayoutChanged?.Invoke(new SurfaceLayoutChangedEventArgs(new[] { sender as IRGBDevice }, false, true));
}
#endregion
diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs
index dbfb993..d8efe6b 100644
--- a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs
+++ b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs
@@ -19,9 +19,6 @@ namespace RGB.NET.Devices.Corsair
///
public override IRGBDeviceInfo DeviceInfo { get; }
- ///
- protected override Size InternalSize { get; set; }
-
#endregion
#region Constructors
@@ -45,7 +42,7 @@ namespace RGB.NET.Devices.Corsair
internal void Initialize()
{
InitializeLeds();
-
+
Rectangle ledRectangle = new Rectangle(this.Select(x => x.LedRectangle));
InternalSize = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y);
}
diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs
index 2b3bc68..b8d9a84 100644
--- a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs
+++ b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs
@@ -31,6 +31,9 @@ namespace RGB.NET.Devices.Corsair
///
public string Model { get; }
+ ///
+ public Uri Image { get; protected set; }
+
///
/// Gets a flag that describes device capabilities. ()
///
diff --git a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs
index 09abf44..695d5ee 100644
--- a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs
+++ b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs
@@ -1,4 +1,5 @@
-using RGB.NET.Devices.Corsair.Native;
+using System;
+using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
@@ -16,7 +17,9 @@ namespace RGB.NET.Devices.Corsair
/// The native -struct
internal CorsairHeadsetRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
: base(deviceIndex, Core.RGBDeviceType.Headset, nativeInfo)
- { }
+ {
+ Image = new Uri($"pack://application:,,,/RGB.NET.Devices.Corsair;component/Images/Headsets/{Model.Replace(" ", string.Empty).ToUpper()}.png", UriKind.Absolute);
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs
index 25e772c..459dc6d 100644
--- a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs
+++ b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs
@@ -1,6 +1,7 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
+using System;
using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
@@ -36,6 +37,8 @@ namespace RGB.NET.Devices.Corsair
{
this.PhysicalLayout = (CorsairPhysicalKeyboardLayout)nativeInfo.physicalLayout;
this.LogicalLayout = (CorsairLogicalKeyboardLayout)nativeInfo.logicalLayout;
+
+ Image = new Uri($"pack://application:,,,/RGB.NET.Devices.Corsair;component/Images/Keyboards/{Model.Replace(" ", string.Empty).ToUpper()}/{LogicalLayout.ToString().ToUpper()}.png", UriKind.Absolute);
}
#endregion
diff --git a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs
index 00af3dc..018067d 100644
--- a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs
+++ b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs
@@ -1,4 +1,5 @@
-using RGB.NET.Devices.Corsair.Native;
+using System;
+using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
@@ -27,6 +28,8 @@ namespace RGB.NET.Devices.Corsair
: base(deviceIndex, Core.RGBDeviceType.Mouse, nativeInfo)
{
this.PhysicalLayout = (CorsairPhysicalMouseLayout)nativeInfo.physicalLayout;
+
+ Image = new Uri($"pack://application:,,,/RGB.NET.Devices.Corsair;component/Images/Mice/{Model.Replace(" ", string.Empty).ToUpper()}.png", UriKind.Absolute);
}
#endregion
diff --git a/RGB.NET.Devices.Corsair/Mousmat/CorsairMousematRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Mousmat/CorsairMousematRGBDeviceInfo.cs
index ea696ce..1573439 100644
--- a/RGB.NET.Devices.Corsair/Mousmat/CorsairMousematRGBDeviceInfo.cs
+++ b/RGB.NET.Devices.Corsair/Mousmat/CorsairMousematRGBDeviceInfo.cs
@@ -1,4 +1,5 @@
-using RGB.NET.Devices.Corsair.Native;
+using System;
+using RGB.NET.Devices.Corsair.Native;
namespace RGB.NET.Devices.Corsair
{
@@ -16,7 +17,9 @@ namespace RGB.NET.Devices.Corsair
/// The native -struct
internal CorsairMousematRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo)
: base(deviceIndex, Core.RGBDeviceType.Mousemat, nativeInfo)
- { }
+ {
+ Image = new Uri($"pack://application:,,,/RGB.NET.Devices.Corsair;component/Images/Mousemat/{Model.Replace(" ", string.Empty).ToUpper()}.png", UriKind.Absolute);
+ }
#endregion
}
diff --git a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj
index 1d4c210..62ab8aa 100644
--- a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj
+++ b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj
@@ -84,6 +84,12 @@
+
+
+
+
+
+