diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj
index b9d5030a1..2a8ac8d4e 100644
--- a/src/Artemis.Core/Artemis.Core.csproj
+++ b/src/Artemis.Core/Artemis.Core.csproj
@@ -68,39 +68,6 @@
..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll
-
- ..\packages\RGB.NET.Brushes.0.0.1.20\lib\net45\RGB.NET.Brushes.dll
-
-
- ..\packages\RGB.NET.Core.0.0.1.20\lib\net45\RGB.NET.Core.dll
-
-
- ..\packages\RGB.NET.Decorators.0.0.1.20\lib\net45\RGB.NET.Decorators.dll
-
-
- ..\packages\RGB.NET.Devices.Asus.0.0.1.20\lib\net45\RGB.NET.Devices.Asus.dll
-
-
- ..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\lib\net45\RGB.NET.Devices.CoolerMaster.dll
-
-
- ..\packages\RGB.NET.Devices.Corsair.0.0.1.20\lib\net45\RGB.NET.Devices.Corsair.dll
-
-
- ..\packages\RGB.NET.Devices.Logitech.0.0.1.20\lib\net45\RGB.NET.Devices.Logitech.dll
-
-
- ..\packages\RGB.NET.Devices.Msi.0.0.1.20\lib\net45\RGB.NET.Devices.Msi.dll
-
-
- ..\packages\RGB.NET.Devices.Novation.0.0.1.20\lib\net45\RGB.NET.Devices.Novation.dll
-
-
- ..\packages\RGB.NET.Devices.Razer.0.0.1.20\lib\net45\RGB.NET.Devices.Razer.dll
-
-
- ..\packages\RGB.NET.Groups.0.0.1.20\lib\net45\RGB.NET.Groups.dll
-
..\packages\Sanford.Multimedia.Midi.6.4.2\lib\net20\Sanford.Multimedia.Midi.dll
@@ -188,10 +155,14 @@
+
+
+
-
+
+
@@ -207,27 +178,65 @@
+
+ {347c5f0f-f490-4dec-9c1c-6e84750d838d}
+ RGB.NET.Brushes
+
+
+ {5a4f9a75-75fe-47cd-90e5-914d5b20d232}
+ RGB.NET.Core
+
+
+ {7012c431-244a-453f-b7fd-59e030cdbc44}
+ RGB.NET.Decorators
+
+
+ {4f2f3fbd-a1e4-4968-a2ad-0514959e5e59}
+ RGB.NET.Devices.Asus
+
+
+ {85609427-d433-44e2-a249-ce890b66d845}
+ RGB.NET.Devices.CoolerMaster
+
+
+ {dda8c4c2-8abf-4fa0-9af9-c47ad0bfe47d}
+ RGB.NET.Devices.Corsair
+
+
+ {e7b2f174-fcc6-4fc7-9970-3138b5f4c921}
+ RGB.NET.Devices.Logitech
+
+
+ {4efd77c7-fdb4-4c6b-970c-0ef66d24be09}
+ RGB.NET.Devices.Msi
+
+
+ {db2911f6-404c-4bc8-b35f-232a7450755f}
+ RGB.NET.Devices.Novation
+
+
+ {24ff4acb-d679-4b2d-86d4-50ab6c02d816}
+ RGB.NET.Devices.Razer
+
+
+ {2a39f859-aad0-4c16-94f8-78057820b376}
+ RGB.NET.Groups
+
+
+ {f905c418-76bb-4ba6-88ab-0793bc2681d3}
+ RGB.NET.Input.Corsair
+
+
+ {e60c3c6f-903f-4d80-99d0-7a1e50af5a9d}
+ RGB.NET.Input
+
{cd23bc5e-57f0-46ce-a007-24d031146219}
Artemis.Plugins
+
+
+
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Artemis.Core/ProfileElements/Folder.cs b/src/Artemis.Core/ProfileElements/Folder.cs
new file mode 100644
index 000000000..370b3cae3
--- /dev/null
+++ b/src/Artemis.Core/ProfileElements/Folder.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using Artemis.Core.ProfileElements.Interfaces;
+using RGB.NET.Core;
+
+namespace Artemis.Core.ProfileElements
+{
+ public class Folder : IProfileElement
+ {
+ public List Children { get; set; }
+
+ public void Update()
+ {
+ foreach (var profileElement in Children)
+ profileElement.Update();
+ }
+
+ public void Render(IRGBDevice rgbDevice)
+ {
+ foreach (var profileElement in Children)
+ profileElement.Render(rgbDevice);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/ProfileElements/Interfaces/IProfileElement.cs b/src/Artemis.Core/ProfileElements/Interfaces/IProfileElement.cs
new file mode 100644
index 000000000..3b6886013
--- /dev/null
+++ b/src/Artemis.Core/ProfileElements/Interfaces/IProfileElement.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using RGB.NET.Core;
+
+namespace Artemis.Core.ProfileElements.Interfaces
+{
+ public interface IProfileElement
+ {
+ ///
+ /// The element's children
+ ///
+ List Children { get; set; }
+
+ ///
+ /// Updates the element
+ ///
+ void Update();
+
+ ///
+ /// Renders the element
+ ///
+ void Render(IRGBDevice rgbDevice);
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/ProfileElements/Profile.cs b/src/Artemis.Core/ProfileElements/Profile.cs
new file mode 100644
index 000000000..a463fac81
--- /dev/null
+++ b/src/Artemis.Core/ProfileElements/Profile.cs
@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using Artemis.Core.ProfileElements.Interfaces;
+using RGB.NET.Core;
+
+namespace Artemis.Core.ProfileElements
+{
+ public class Profile : IProfileElement
+ {
+ public List Children { get; set; }
+
+ public void Update()
+ {
+ }
+
+ public void Render(IRGBDevice rgbDevice)
+ {
+ foreach (var profileElement in Children)
+ profileElement.Render(rgbDevice);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/Services/CoreService.cs b/src/Artemis.Core/Services/CoreService.cs
index 82c66e1f4..bd3c697f3 100644
--- a/src/Artemis.Core/Services/CoreService.cs
+++ b/src/Artemis.Core/Services/CoreService.cs
@@ -1,22 +1,26 @@
-using System.Threading.Tasks;
+using System;
+using System.Threading.Tasks;
+using Artemis.Core.Exceptions;
using Artemis.Core.Services.Interfaces;
namespace Artemis.Core.Services
{
public class CoreService : ICoreService
{
+ private readonly IRgbService _rgbService;
private readonly IPluginService _pluginService;
- private readonly IDeviceService _deviceService;
- public CoreService(IPluginService pluginService, IDeviceService deviceService)
+ public CoreService(IPluginService pluginService, IRgbService rgbService)
{
_pluginService = pluginService;
- _deviceService = deviceService;
+ _rgbService = rgbService;
+
Task.Run(Initialize);
}
public void Dispose()
{
+ // Dispose services
_pluginService.Dispose();
}
@@ -24,9 +28,26 @@ namespace Artemis.Core.Services
private async Task Initialize()
{
+ if (IsInitialized)
+ throw new ArtemisCoreException("Cannot initialize the core as it is already initialized.");
+
+ // Initialize the services
await _pluginService.LoadPlugins();
- await _deviceService.LoadDevices();
- IsInitialized = true;
+ await _rgbService.LoadDevices();
+
+ OnInitialized();
}
+
+ #region Events
+
+ public event EventHandler Initialized;
+
+ private void OnInitialized()
+ {
+ IsInitialized = true;
+ Initialized?.Invoke(this, EventArgs.Empty);
+ }
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/src/Artemis.Core/Services/Interfaces/ICoreService.cs b/src/Artemis.Core/Services/Interfaces/ICoreService.cs
index 79ecdb825..b99f00d75 100644
--- a/src/Artemis.Core/Services/Interfaces/ICoreService.cs
+++ b/src/Artemis.Core/Services/Interfaces/ICoreService.cs
@@ -1,9 +1,15 @@
using System;
+using Artemis.Core.Events;
namespace Artemis.Core.Services.Interfaces
{
public interface ICoreService: IArtemisService, IDisposable
{
bool IsInitialized { get; set; }
+
+ ///
+ /// Occurs the core has finished initializing
+ ///
+ event EventHandler Initialized;
}
}
\ No newline at end of file
diff --git a/src/Artemis.Core/Services/Interfaces/IRgbService.cs b/src/Artemis.Core/Services/Interfaces/IRgbService.cs
new file mode 100644
index 000000000..ced041101
--- /dev/null
+++ b/src/Artemis.Core/Services/Interfaces/IRgbService.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Threading.Tasks;
+using Artemis.Core.Events;
+using RGB.NET.Core;
+
+namespace Artemis.Core.Services.Interfaces
+{
+ public interface IRgbService : IArtemisService
+ {
+ bool LoadingDevices { get; }
+ RGBSurface Surface { get; set; }
+ Task LoadDevices();
+ void Dispose();
+
+ ///
+ /// Occurs when a single device has loaded
+ ///
+ event EventHandler DeviceLoaded;
+
+ ///
+ /// Occurs when a single device has reloaded
+ ///
+ event EventHandler DeviceReloaded;
+
+ ///
+ /// Occurs when loading all devices has started
+ ///
+ event EventHandler StartingLoadingDevices;
+
+ ///
+ /// Occurs when loading all devices has finished
+ ///
+ event EventHandler FinishedLoadedDevices;
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Core/Services/PluginService.cs b/src/Artemis.Core/Services/PluginService.cs
index e11e981ae..4458128f5 100644
--- a/src/Artemis.Core/Services/PluginService.cs
+++ b/src/Artemis.Core/Services/PluginService.cs
@@ -32,6 +32,7 @@ namespace Artemis.Core.Services
public bool LoadingPlugins { get; private set; }
public ReadOnlyCollection Plugins => _plugins.AsReadOnly();
+ ///
///
/// Loads all installed plugins. If plugins already loaded this will reload them all
///
diff --git a/src/Artemis.Core/Services/DeviceService.cs b/src/Artemis.Core/Services/RgbService.cs
similarity index 73%
rename from src/Artemis.Core/Services/DeviceService.cs
rename to src/Artemis.Core/Services/RgbService.cs
index 3f45eae4a..c762510ae 100644
--- a/src/Artemis.Core/Services/DeviceService.cs
+++ b/src/Artemis.Core/Services/RgbService.cs
@@ -11,21 +11,25 @@ using RGB.NET.Groups;
namespace Artemis.Core.Services
{
- public class DeviceService : IDeviceService, IDisposable
+ public class RgbService : IRgbService, IDisposable
{
- public DeviceService()
+ public RgbService()
{
Surface = RGBSurface.Instance;
LoadingDevices = false;
// Let's throw these for now
Surface.Exception += SurfaceOnException;
+ Surface.UpdateMode = UpdateMode.Continuous;
}
+ ///
public bool LoadingDevices { get; private set; }
+ ///
public RGBSurface Surface { get; set; }
+ ///
public async Task LoadDevices()
{
OnStartedLoadingDevices();
@@ -33,19 +37,19 @@ namespace Artemis.Core.Services
await Task.Run(() =>
{
// TODO SpoinkyNL 8-1-18: Keep settings into account
-// Surface.LoadDevices(AsusDeviceProvider.Instance);
+ // Surface.LoadDevices(AsusDeviceProvider.Instance);
Surface.LoadDevices(CorsairDeviceProvider.Instance);
Surface.LoadDevices(LogitechDeviceProvider.Instance);
Surface.LoadDevices(CoolerMasterDeviceProvider.Instance);
-// Surface.LoadDevices(NovationDeviceProvider.Instance);
-
+ // Surface.LoadDevices(NovationDeviceProvider.Instance);
+
// TODO SpoinkyNL 8-1-18: Load alignment
Surface.AlignDevies();
// Do some testing, why does this work, how does it know I want to target the surface? Check source!
var ledGroup = new RectangleLedGroup(Surface.SurfaceRectangle)
{
- Brush = new SolidColorBrush(new Color(255, 0, 0)) {BrushCalculationMode = BrushCalculationMode.Absolute}
+ Brush = new SolidColorBrush(new Color(255, 0, 0)) { BrushCalculationMode = BrushCalculationMode.Absolute }
};
Surface.UpdateMode = UpdateMode.Continuous;
});
@@ -65,24 +69,9 @@ namespace Artemis.Core.Services
#region Events
- ///
- /// Occurs when a single device has loaded
- ///
public event EventHandler DeviceLoaded;
-
- ///
- /// Occurs when a single device has reloaded
- ///
public event EventHandler DeviceReloaded;
-
- ///
- /// Occurs when loading all devices has started
- ///
- public event EventHandler StartedLoadingDevices;
-
- ///
- /// Occurs when loading all devices has finished
- ///
+ public event EventHandler StartingLoadingDevices;
public event EventHandler FinishedLoadedDevices;
private void OnDeviceLoaded(DeviceEventArgs e)
@@ -98,7 +87,7 @@ namespace Artemis.Core.Services
private void OnStartedLoadingDevices()
{
LoadingDevices = true;
- StartedLoadingDevices?.Invoke(this, EventArgs.Empty);
+ StartingLoadingDevices?.Invoke(this, EventArgs.Empty);
}
private void OnFinishedLoadedDevices()
@@ -109,9 +98,4 @@ namespace Artemis.Core.Services
#endregion
}
-
- public interface IDeviceService : IArtemisService
- {
- Task LoadDevices();
- }
}
\ No newline at end of file
diff --git a/src/Artemis.Core/packages.config b/src/Artemis.Core/packages.config
index 34f6373ff..7257243c9 100644
--- a/src/Artemis.Core/packages.config
+++ b/src/Artemis.Core/packages.config
@@ -13,20 +13,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Artemis.UI/App.xaml b/src/Artemis.UI/App.xaml
index e35fc8d83..e024b2889 100644
--- a/src/Artemis.UI/App.xaml
+++ b/src/Artemis.UI/App.xaml
@@ -36,6 +36,10 @@
+
+
+
+
diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj
index 569fbeec4..cefcbc905 100644
--- a/src/Artemis.UI/Artemis.UI.csproj
+++ b/src/Artemis.UI/Artemis.UI.csproj
@@ -37,7 +37,7 @@
- ..\packages\Castle.Core.4.2.0\lib\net45\Castle.Core.dll
+ ..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll
..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll
@@ -92,6 +92,10 @@
Designer
+
+
+
+
@@ -106,6 +110,18 @@
Code
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -149,6 +165,58 @@
+
+ {347c5f0f-f490-4dec-9c1c-6e84750d838d}
+ RGB.NET.Brushes
+
+
+ {5a4f9a75-75fe-47cd-90e5-914d5b20d232}
+ RGB.NET.Core
+
+
+ {7012c431-244a-453f-b7fd-59e030cdbc44}
+ RGB.NET.Decorators
+
+
+ {4f2f3fbd-a1e4-4968-a2ad-0514959e5e59}
+ RGB.NET.Devices.Asus
+
+
+ {85609427-d433-44e2-a249-ce890b66d845}
+ RGB.NET.Devices.CoolerMaster
+
+
+ {dda8c4c2-8abf-4fa0-9af9-c47ad0bfe47d}
+ RGB.NET.Devices.Corsair
+
+
+ {e7b2f174-fcc6-4fc7-9970-3138b5f4c921}
+ RGB.NET.Devices.Logitech
+
+
+ {4efd77c7-fdb4-4c6b-970c-0ef66d24be09}
+ RGB.NET.Devices.Msi
+
+
+ {db2911f6-404c-4bc8-b35f-232a7450755f}
+ RGB.NET.Devices.Novation
+
+
+ {24ff4acb-d679-4b2d-86d4-50ab6c02d816}
+ RGB.NET.Devices.Razer
+
+
+ {2a39f859-aad0-4c16-94f8-78057820b376}
+ RGB.NET.Groups
+
+
+ {f905c418-76bb-4ba6-88ab-0793bc2681d3}
+ RGB.NET.Input.Corsair
+
+
+ {e60c3c6f-903f-4d80-99d0-7a1e50af5a9d}
+ RGB.NET.Input
+
{9b811f9b-86b9-4771-87af-72bae7078a36}
Artemis.Core
@@ -171,17 +239,16 @@
-
-
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Controls/Visualizers/LedVisualizer.cs b/src/Artemis.UI/Controls/Visualizers/LedVisualizer.cs
new file mode 100644
index 000000000..436302cc3
--- /dev/null
+++ b/src/Artemis.UI/Controls/Visualizers/LedVisualizer.cs
@@ -0,0 +1,36 @@
+using System.Windows;
+using System.Windows.Controls;
+using RGB.NET.Core;
+
+namespace Artemis.UI.Controls.Visualizers
+{
+ ///
+ ///
+ /// Visualizes a in an wpf-application.
+ ///
+ public class LedVisualizer : Control
+ {
+ #region DependencyProperties
+
+ // ReSharper disable InconsistentNaming
+
+ ///
+ /// Backing-property for the -property.
+ ///
+ public static readonly DependencyProperty LedProperty = DependencyProperty.Register(
+ "Led", typeof(Led), typeof(LedVisualizer), new PropertyMetadata(default(Led)));
+
+ ///
+ /// Gets or sets the to visualize.
+ ///
+ public Led Led
+ {
+ get => (Led) GetValue(LedProperty);
+ set => SetValue(LedProperty, value);
+ }
+
+ // ReSharper restore InconsistentNaming
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Controls/Visualizers/RGBDeviceVisualizer.cs b/src/Artemis.UI/Controls/Visualizers/RGBDeviceVisualizer.cs
new file mode 100644
index 000000000..bfc6e281e
--- /dev/null
+++ b/src/Artemis.UI/Controls/Visualizers/RGBDeviceVisualizer.cs
@@ -0,0 +1,78 @@
+using System.Windows;
+using System.Windows.Controls;
+using RGB.NET.Core;
+
+namespace Artemis.UI.Controls.Visualizers
+{
+ ///
+ ///
+ /// Visualizes a in an wpf-application.
+ ///
+ [TemplatePart(Name = PART_CANVAS, Type = typeof(Canvas))]
+ public class RGBDeviceVisualizer : Control
+ {
+ #region Constants
+
+ private const string PART_CANVAS = "PART_Canvas";
+
+ #endregion
+
+ #region Properties & Fields
+
+ private Canvas _canvas;
+
+ #endregion
+
+ #region DependencyProperties
+
+ // ReSharper disable InconsistentNaming
+
+ ///
+ /// Backing-property for the -property.
+ ///
+ public static readonly DependencyProperty DeviceProperty = DependencyProperty.Register(
+ "Device", typeof(IRGBDevice), typeof(RGBDeviceVisualizer), new PropertyMetadata(default(IRGBDevice), DeviceChanged));
+
+ ///
+ /// Gets or sets the to visualize.
+ ///
+ public IRGBDevice Device
+ {
+ get => (IRGBDevice) GetValue(DeviceProperty);
+ set => SetValue(DeviceProperty, value);
+ }
+
+ // ReSharper restore InconsistentNaming
+
+ #endregion
+
+ #region Methods
+
+ ///
+ public override void OnApplyTemplate()
+ {
+ _canvas = (Canvas) GetTemplateChild(PART_CANVAS);
+
+ LayoutLeds();
+ }
+
+ private static void DeviceChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
+ {
+ ((RGBDeviceVisualizer) dependencyObject).LayoutLeds();
+ }
+
+ private void LayoutLeds()
+ {
+ if (_canvas == null) return;
+
+ _canvas.Children.Clear();
+
+ if (Device == null) return;
+
+ foreach (Led led in Device)
+ _canvas.Children.Add(new LedVisualizer {Led = led});
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Controls/Visualizers/RGBSurfaceVisualizer.cs b/src/Artemis.UI/Controls/Visualizers/RGBSurfaceVisualizer.cs
new file mode 100644
index 000000000..5d27f1773
--- /dev/null
+++ b/src/Artemis.UI/Controls/Visualizers/RGBSurfaceVisualizer.cs
@@ -0,0 +1,99 @@
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+using RGB.NET.Core;
+
+namespace Artemis.UI.Controls.Visualizers
+{
+ ///
+ ///
+ /// Visualizes the in an wpf-application.
+ ///
+ [TemplatePart(Name = PART_CANVAS, Type = typeof(Canvas))]
+ public class RGBSurfaceVisualizer : Control
+ {
+ #region Constants
+
+ private const string PART_CANVAS = "PART_Canvas";
+
+ #endregion
+
+ #region Properties & Fields
+
+ private RGBSurface _surface;
+ private Canvas _canvas;
+
+ //TODO DarthAffe 17.06.2017: This is ugly - redesign how device connect/disconnect is generally handled!
+ private readonly List _newDevices = new List();
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public RGBSurfaceVisualizer()
+ {
+ this.Loaded += OnLoaded;
+ this.Unloaded += OnUnloaded;
+ }
+
+ private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
+ {
+ _surface = RGBSurface.Instance;
+
+ _surface.SurfaceLayoutChanged += RGBSurfaceOnSurfaceLayoutChanged;
+ foreach (IRGBDevice device in _surface.Devices)
+ _newDevices.Add(device);
+
+ UpdateSurface();
+ }
+
+ private void OnUnloaded(object sender, RoutedEventArgs routedEventArgs)
+ {
+ _surface.SurfaceLayoutChanged -= RGBSurfaceOnSurfaceLayoutChanged;
+ _canvas?.Children.Clear();
+ _newDevices.Clear();
+ }
+
+ private void RGBSurfaceOnSurfaceLayoutChanged(SurfaceLayoutChangedEventArgs args)
+ {
+ if (args.DeviceAdded)
+ foreach (IRGBDevice device in args.Devices)
+ _newDevices.Add(device);
+
+ UpdateSurface();
+ }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ public override void OnApplyTemplate()
+ {
+ _canvas?.Children.Clear();
+ _canvas = (Canvas)GetTemplateChild(PART_CANVAS);
+ UpdateSurface();
+ }
+
+ private void UpdateSurface()
+ {
+ if ((_canvas == null) || (_surface == null)) return;
+
+ if (_newDevices.Count > 0)
+ {
+ foreach (IRGBDevice device in _newDevices)
+ _canvas.Children.Add(new RGBDeviceVisualizer { Device = device });
+ _newDevices.Clear();
+ }
+
+ _canvas.Width = _surface.SurfaceRectangle.Size.Width;
+ _canvas.Height = _surface.SurfaceRectangle.Size.Height;
+ }
+
+ #endregion
+ }
+}
diff --git a/src/Artemis.UI/Converters/ColorToSolidColorBrushConverter.cs b/src/Artemis.UI/Converters/ColorToSolidColorBrushConverter.cs
new file mode 100644
index 000000000..51107717b
--- /dev/null
+++ b/src/Artemis.UI/Converters/ColorToSolidColorBrushConverter.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace Artemis.UI.Converters
+{
+ ///
+ ///
+ /// Converts into .
+ ///
+ [ValueConversion(typeof(RGB.NET.Core.Color), typeof(SolidColorBrush))]
+ public class ColorToSolidColorBrushConverter : IValueConverter
+ {
+ ///
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return new SolidColorBrush(!(value is RGB.NET.Core.Color color)
+ ? Color.FromArgb(0, 0, 0, 0)
+ : Color.FromArgb(color.A, color.R, color.G, color.B));
+ }
+
+ ///
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return !(value is SolidColorBrush brush)
+ ? RGB.NET.Core.Color.Transparent
+ : new RGB.NET.Core.Color(brush.Color.A, brush.Color.R, brush.Color.G, brush.Color.B);
+ }
+ }
+}
diff --git a/src/Artemis.UI/Styles/Visualizers/LedVisualizer.xaml b/src/Artemis.UI/Styles/Visualizers/LedVisualizer.xaml
new file mode 100644
index 000000000..c4f447c65
--- /dev/null
+++ b/src/Artemis.UI/Styles/Visualizers/LedVisualizer.xaml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Styles/Visualizers/RGBDeviceVisualizer.xaml b/src/Artemis.UI/Styles/Visualizers/RGBDeviceVisualizer.xaml
new file mode 100644
index 000000000..679977043
--- /dev/null
+++ b/src/Artemis.UI/Styles/Visualizers/RGBDeviceVisualizer.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Styles/Visualizers/RGBSurfaceVisualizer.xaml b/src/Artemis.UI/Styles/Visualizers/RGBSurfaceVisualizer.xaml
new file mode 100644
index 000000000..72212954d
--- /dev/null
+++ b/src/Artemis.UI/Styles/Visualizers/RGBSurfaceVisualizer.xaml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/SettingsViewModel.cs b/src/Artemis.UI/ViewModels/SettingsViewModel.cs
index 97f6dd8ec..c884cc9c1 100644
--- a/src/Artemis.UI/ViewModels/SettingsViewModel.cs
+++ b/src/Artemis.UI/ViewModels/SettingsViewModel.cs
@@ -1,10 +1,37 @@
-using Artemis.UI.ViewModels.Interfaces;
+using System.Linq;
+using Artemis.Core.Services.Interfaces;
+using Artemis.UI.ViewModels.Interfaces;
+using RGB.NET.Core;
using Stylet;
namespace Artemis.UI.ViewModels
{
public class SettingsViewModel : Screen, ISettingsViewModel
{
+ private readonly IRgbService _rgbService;
+
+ public SettingsViewModel(IRgbService rgbService)
+ {
+ _rgbService = rgbService;
+ _rgbService.FinishedLoadedDevices += (sender, args) => SetTestDevice();
+ }
+
+ protected override void OnActivate()
+ {
+ SetTestDevice();
+ base.OnActivate();
+ }
+
+ private void SetTestDevice()
+ {
+ if (!IsActive)
+ return;
+
+ if (!_rgbService.LoadingDevices)
+ TestDevice = _rgbService.Surface.Devices.FirstOrDefault(d => d.DeviceInfo.DeviceType == RGBDeviceType.Keyboard);
+ }
+
+ public IRGBDevice TestDevice { get; set; }
public string Title => "Settings";
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI/Views/SettingsView.xaml b/src/Artemis.UI/Views/SettingsView.xaml
index 40f0255f8..f8cf757eb 100644
--- a/src/Artemis.UI/Views/SettingsView.xaml
+++ b/src/Artemis.UI/Views/SettingsView.xaml
@@ -4,7 +4,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.UI.Views"
+ xmlns:visualizers="clr-namespace:Artemis.UI.Controls.Visualizers"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
-
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/packages.config b/src/Artemis.UI/packages.config
index 6e68cc308..3455f3582 100644
--- a/src/Artemis.UI/packages.config
+++ b/src/Artemis.UI/packages.config
@@ -1,8 +1,7 @@
-
-
-
+
+
diff --git a/src/Artemis.sln b/src/Artemis.sln
index 58e1f8529..6976bcc7c 100644
--- a/src/Artemis.sln
+++ b/src/Artemis.sln
@@ -11,6 +11,40 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Core", "Artemis.Cor
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Plugins", "Artemis.Plugins\Artemis.Plugins.csproj", "{CD23BC5E-57F0-46CE-A007-24D031146219}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RGB.NET", "RGB.NET", "{9E919613-35F5-410D-80B3-F4FB69BE327B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Core", "..\..\RGB.NET\RGB.NET.Core\RGB.NET.Core.csproj", "{5A4F9A75-75FE-47CD-90E5-914D5B20D232}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Input", "..\..\RGB.NET\RGB.NET.Input\RGB.NET.Input.csproj", "{E60C3C6F-903F-4D80-99D0-7A1E50AF5A9D}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Devices", "Devices", "{03DD6C1C-B39B-4D1E-A905-EBDA94FCEBFA}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Presets", "Presets", "{87F6ED2F-10C1-43BB-B5CE-E95DF6C8ADCE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Devices.Asus", "..\..\RGB.NET\RGB.NET.Devices.Asus\RGB.NET.Devices.Asus.csproj", "{4F2F3FBD-A1E4-4968-A2AD-0514959E5E59}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Devices.CoolerMaster", "..\..\RGB.NET\RGB.NET.Devices.CoolerMaster\RGB.NET.Devices.CoolerMaster.csproj", "{85609427-D433-44E2-A249-CE890B66D845}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Devices.Corsair", "..\..\RGB.NET\RGB.NET.Devices.Corsair\RGB.NET.Devices.Corsair.csproj", "{DDA8C4C2-8ABF-4FA0-9AF9-C47AD0BFE47D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Devices.Logitech", "..\..\RGB.NET\RGB.NET.Devices.Logitech\RGB.NET.Devices.Logitech.csproj", "{E7B2F174-FCC6-4FC7-9970-3138B5F4C921}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Devices.Msi", "..\..\RGB.NET\RGB.NET.Devices.Msi\RGB.NET.Devices.Msi.csproj", "{4EFD77C7-FDB4-4C6B-970C-0EF66D24BE09}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Devices.Novation", "..\..\RGB.NET\RGB.NET.Devices.Novation\RGB.NET.Devices.Novation.csproj", "{DB2911F6-404C-4BC8-B35F-232A7450755F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Devices.Razer", "..\..\RGB.NET\RGB.NET.Devices.Razer\RGB.NET.Devices.Razer.csproj", "{24FF4ACB-D679-4B2D-86D4-50AB6C02D816}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Input", "Input", "{F1DE1C8B-E8B1-45EF-9FE8-47EF3B2E4D6E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Input.Corsair", "..\..\RGB.NET\RGB.NET.Input.Corsair\RGB.NET.Input.Corsair.csproj", "{F905C418-76BB-4BA6-88AB-0793BC2681D3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Brushes", "..\..\RGB.NET\RGB.NET.Brushes\RGB.NET.Brushes.csproj", "{347C5F0F-F490-4DEC-9C1C-6E84750D838D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Decorators", "..\..\RGB.NET\RGB.NET.Decorators\RGB.NET.Decorators.csproj", "{7012C431-244A-453F-B7FD-59E030CDBC44}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGB.NET.Groups", "..\..\RGB.NET\RGB.NET.Groups\RGB.NET.Groups.csproj", "{2A39F859-AAD0-4C16-94F8-78057820B376}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -33,10 +67,80 @@ Global
{CD23BC5E-57F0-46CE-A007-24D031146219}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD23BC5E-57F0-46CE-A007-24D031146219}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD23BC5E-57F0-46CE-A007-24D031146219}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5A4F9A75-75FE-47CD-90E5-914D5B20D232}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5A4F9A75-75FE-47CD-90E5-914D5B20D232}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5A4F9A75-75FE-47CD-90E5-914D5B20D232}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5A4F9A75-75FE-47CD-90E5-914D5B20D232}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E60C3C6F-903F-4D80-99D0-7A1E50AF5A9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E60C3C6F-903F-4D80-99D0-7A1E50AF5A9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E60C3C6F-903F-4D80-99D0-7A1E50AF5A9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E60C3C6F-903F-4D80-99D0-7A1E50AF5A9D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4F2F3FBD-A1E4-4968-A2AD-0514959E5E59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4F2F3FBD-A1E4-4968-A2AD-0514959E5E59}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4F2F3FBD-A1E4-4968-A2AD-0514959E5E59}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4F2F3FBD-A1E4-4968-A2AD-0514959E5E59}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85609427-D433-44E2-A249-CE890B66D845}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85609427-D433-44E2-A249-CE890B66D845}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85609427-D433-44E2-A249-CE890B66D845}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85609427-D433-44E2-A249-CE890B66D845}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DDA8C4C2-8ABF-4FA0-9AF9-C47AD0BFE47D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DDA8C4C2-8ABF-4FA0-9AF9-C47AD0BFE47D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DDA8C4C2-8ABF-4FA0-9AF9-C47AD0BFE47D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DDA8C4C2-8ABF-4FA0-9AF9-C47AD0BFE47D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E7B2F174-FCC6-4FC7-9970-3138B5F4C921}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E7B2F174-FCC6-4FC7-9970-3138B5F4C921}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E7B2F174-FCC6-4FC7-9970-3138B5F4C921}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E7B2F174-FCC6-4FC7-9970-3138B5F4C921}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4EFD77C7-FDB4-4C6B-970C-0EF66D24BE09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4EFD77C7-FDB4-4C6B-970C-0EF66D24BE09}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4EFD77C7-FDB4-4C6B-970C-0EF66D24BE09}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4EFD77C7-FDB4-4C6B-970C-0EF66D24BE09}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DB2911F6-404C-4BC8-B35F-232A7450755F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DB2911F6-404C-4BC8-B35F-232A7450755F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DB2911F6-404C-4BC8-B35F-232A7450755F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DB2911F6-404C-4BC8-B35F-232A7450755F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {24FF4ACB-D679-4B2D-86D4-50AB6C02D816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {24FF4ACB-D679-4B2D-86D4-50AB6C02D816}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {24FF4ACB-D679-4B2D-86D4-50AB6C02D816}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {24FF4ACB-D679-4B2D-86D4-50AB6C02D816}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F905C418-76BB-4BA6-88AB-0793BC2681D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F905C418-76BB-4BA6-88AB-0793BC2681D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F905C418-76BB-4BA6-88AB-0793BC2681D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F905C418-76BB-4BA6-88AB-0793BC2681D3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {347C5F0F-F490-4DEC-9C1C-6E84750D838D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {347C5F0F-F490-4DEC-9C1C-6E84750D838D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {347C5F0F-F490-4DEC-9C1C-6E84750D838D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {347C5F0F-F490-4DEC-9C1C-6E84750D838D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7012C431-244A-453F-B7FD-59E030CDBC44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7012C431-244A-453F-B7FD-59E030CDBC44}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7012C431-244A-453F-B7FD-59E030CDBC44}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7012C431-244A-453F-B7FD-59E030CDBC44}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2A39F859-AAD0-4C16-94F8-78057820B376}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2A39F859-AAD0-4C16-94F8-78057820B376}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2A39F859-AAD0-4C16-94F8-78057820B376}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2A39F859-AAD0-4C16-94F8-78057820B376}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {5A4F9A75-75FE-47CD-90E5-914D5B20D232} = {9E919613-35F5-410D-80B3-F4FB69BE327B}
+ {E60C3C6F-903F-4D80-99D0-7A1E50AF5A9D} = {9E919613-35F5-410D-80B3-F4FB69BE327B}
+ {03DD6C1C-B39B-4D1E-A905-EBDA94FCEBFA} = {9E919613-35F5-410D-80B3-F4FB69BE327B}
+ {87F6ED2F-10C1-43BB-B5CE-E95DF6C8ADCE} = {9E919613-35F5-410D-80B3-F4FB69BE327B}
+ {4F2F3FBD-A1E4-4968-A2AD-0514959E5E59} = {03DD6C1C-B39B-4D1E-A905-EBDA94FCEBFA}
+ {85609427-D433-44E2-A249-CE890B66D845} = {03DD6C1C-B39B-4D1E-A905-EBDA94FCEBFA}
+ {DDA8C4C2-8ABF-4FA0-9AF9-C47AD0BFE47D} = {03DD6C1C-B39B-4D1E-A905-EBDA94FCEBFA}
+ {E7B2F174-FCC6-4FC7-9970-3138B5F4C921} = {03DD6C1C-B39B-4D1E-A905-EBDA94FCEBFA}
+ {4EFD77C7-FDB4-4C6B-970C-0EF66D24BE09} = {03DD6C1C-B39B-4D1E-A905-EBDA94FCEBFA}
+ {DB2911F6-404C-4BC8-B35F-232A7450755F} = {03DD6C1C-B39B-4D1E-A905-EBDA94FCEBFA}
+ {24FF4ACB-D679-4B2D-86D4-50AB6C02D816} = {03DD6C1C-B39B-4D1E-A905-EBDA94FCEBFA}
+ {F1DE1C8B-E8B1-45EF-9FE8-47EF3B2E4D6E} = {03DD6C1C-B39B-4D1E-A905-EBDA94FCEBFA}
+ {F905C418-76BB-4BA6-88AB-0793BC2681D3} = {F1DE1C8B-E8B1-45EF-9FE8-47EF3B2E4D6E}
+ {347C5F0F-F490-4DEC-9C1C-6E84750D838D} = {87F6ED2F-10C1-43BB-B5CE-E95DF6C8ADCE}
+ {7012C431-244A-453F-B7FD-59E030CDBC44} = {87F6ED2F-10C1-43BB-B5CE-E95DF6C8ADCE}
+ {2A39F859-AAD0-4C16-94F8-78057820B376} = {87F6ED2F-10C1-43BB-B5CE-E95DF6C8ADCE}
+ EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C203080A-4473-4CC2-844B-F552EA43D66A}
EndGlobalSection