diff --git a/src/Artemis.Core/Models/Surface/ArtemisLed.cs b/src/Artemis.Core/Models/Surface/ArtemisLed.cs
index 5b5cb0910..3b08c7ddd 100644
--- a/src/Artemis.Core/Models/Surface/ArtemisLed.cs
+++ b/src/Artemis.Core/Models/Surface/ArtemisLed.cs
@@ -14,12 +14,13 @@ namespace Artemis.Core.Models.Surface
CalculateRenderRectangle();
}
+ public int LedIndex => Device.Leds.IndexOf(this);
public Led RgbLed { get; }
public ArtemisDevice Device { get; }
public SKRect RenderRectangle { get; private set; }
public SKRect AbsoluteRenderRectangle { get; private set; }
-
+
public void CalculateRenderRectangle()
{
RenderRectangle = SKRect.Create(
diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
index ea639c85c..7f5f9498f 100644
--- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
+++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
@@ -4,10 +4,13 @@ using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Artemis.Core.Models.Surface;
using RGB.NET.Core;
+using Point = System.Windows.Point;
namespace Artemis.UI.Shared.Controls
{
@@ -35,7 +38,7 @@ namespace Artemis.UI.Shared.Controls
Loaded += (sender, args) => SubscribeToUpdate(true);
Unloaded += (sender, args) => SubscribeToUpdate(false);
}
-
+
public ArtemisDevice Device
{
get => (ArtemisDevice) GetValue(DeviceProperty);
@@ -169,7 +172,7 @@ namespace Artemis.UI.Shared.Controls
{
var drawingContext = _backingStore.Open();
- if (HighlightedLeds.Any())
+ if (HighlightedLeds != null && HighlightedLeds.Any())
{
foreach (var deviceVisualizerLed in _deviceVisualizerLeds)
deviceVisualizerLed.RenderColor(drawingContext, !HighlightedLeds.Contains(deviceVisualizerLed.Led));
diff --git a/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugView.xaml b/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugView.xaml
index 59639ee78..36646d865 100644
--- a/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugView.xaml
+++ b/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugView.xaml
@@ -7,6 +7,8 @@
xmlns:s="https://github.com/canton7/Stylet"
xmlns:mde="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
xmlns:debug="clr-namespace:Artemis.UI.Screens.Settings.Debug"
+ xmlns:controls="clr-namespace:Artemis.UI.Shared.Controls;assembly=Artemis.UI.Shared"
+ xmlns:surface="clr-namespace:Artemis.Core.Models.Surface;assembly=Artemis.Core"
mc:Ignorable="d"
Title="Artemis device debugger"
TitleBarIcon="{StaticResource BowIcon}"
@@ -15,33 +17,247 @@
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
UseLayoutRounding="True"
FadeContentIfInactive="False"
- Width="800"
+ Width="840"
Height="800"
- d:DesignHeight="800" d:DesignWidth="800" d:DataContext="{d:DesignInstance debug:DebugViewModel}"
+ d:DesignHeight="800" d:DesignWidth="800" d:DataContext="{d:DesignInstance debug:DeviceDebugViewModel}"
Icon="/Resources/Images/Logo/logo-512.png">
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
In this window you can view detailed information of the device.
Please note that having this window open can have a performance impact on your system.
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Device name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Manufacturer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lighting support
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Device type
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Device image
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Size (1px = 1mm)
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Location (1px = 1mm)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Rotation (degrees)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Syncback supported
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugViewModel.cs b/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugViewModel.cs
index 964f70804..7d980fc49 100644
--- a/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugViewModel.cs
@@ -1,15 +1,78 @@
-using Artemis.Core.Models.Surface;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using Artemis.Core.Models.Surface;
+using Artemis.Core.Services;
+using Artemis.UI.Shared.Services.Interfaces;
+using PropertyChanged;
using Stylet;
namespace Artemis.UI.Screens.Settings.Debug
{
public class DeviceDebugViewModel : Screen
{
- public ArtemisDevice Device { get; }
+ private readonly IDeviceService _deviceService;
+ private readonly IDialogService _dialogService;
- public DeviceDebugViewModel(ArtemisDevice device)
+ public DeviceDebugViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService)
{
+ _deviceService = deviceService;
+ _dialogService = dialogService;
Device = device;
}
+
+ [DependsOn(nameof(SelectedLed))]
+ public List SelectedLeds => SelectedLed != null ? new List {SelectedLed} : null;
+
+ public ArtemisDevice Device { get; }
+ public ArtemisLed SelectedLed { get; set; }
+
+ public bool CanOpenImageDirectory => Device.RgbDevice.DeviceInfo.Image != null;
+
+ // ReSharper disable UnusedMember.Global
+
+ #region Command handlers
+
+ public void ClearSelection()
+ {
+ SelectedLed = null;
+ }
+
+ public void IdentifyDevice()
+ {
+ _deviceService.IdentifyDevice(Device);
+ }
+
+ public async void OpenPluginDirectory()
+ {
+ try
+ {
+ Process.Start(Environment.GetEnvironmentVariable("WINDIR") + @"\explorer.exe", Device.Plugin.PluginInfo.Directory.FullName);
+ }
+ catch (Exception e)
+ {
+ await _dialogService.ShowExceptionDialog("Welp, we couldn't open the device's plugin folder for you", e);
+ }
+ }
+
+ public async void OpenImageDirectory()
+ {
+ if (!CanOpenImageDirectory)
+ return;
+
+ try
+ {
+ Process.Start(Environment.GetEnvironmentVariable("WINDIR") + @"\explorer.exe", Path.GetDirectoryName(Device.RgbDevice.DeviceInfo.Image.AbsolutePath));
+ }
+ catch (Exception e)
+ {
+ await _dialogService.ShowExceptionDialog("Welp, we couldn't open the device's image folder for you", e);
+ }
+ }
+
+ #endregion
+
+ // ReSharper restore UnusedMember.Global
}
}
\ No newline at end of file