diff --git a/src/Artemis.UI/Ninject/Factories/IVMFactory.cs b/src/Artemis.UI/Ninject/Factories/IVMFactory.cs index 32daa2030..1fc61d300 100644 --- a/src/Artemis.UI/Ninject/Factories/IVMFactory.cs +++ b/src/Artemis.UI/Ninject/Factories/IVMFactory.cs @@ -15,6 +15,7 @@ using Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem; using Artemis.UI.Screens.ProfileEditor.Visualization; using Artemis.UI.Screens.ProfileEditor.Visualization.Tools; using Artemis.UI.Screens.Settings.Debug; +using Artemis.UI.Screens.Settings.Debug.Device.Tabs; using Artemis.UI.Screens.Settings.Tabs.Devices; using Artemis.UI.Screens.Settings.Tabs.Plugins; using Artemis.UI.Screens.Shared; @@ -43,7 +44,9 @@ namespace Artemis.UI.Ninject.Factories public interface IDeviceDebugVmFactory : IVmFactory { - DeviceDebugViewModel Create(ArtemisDevice device); + DeviceDebugViewModel DeviceDebugViewModel(ArtemisDevice device); + DevicePropertiesTabViewModel DevicePropertiesTabViewModel(ArtemisDevice device); + DeviceLedsTabViewModel DeviceLedsTabViewModel(ArtemisDevice device); } public interface IProfileTreeVmFactory : IVmFactory diff --git a/src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugView.xaml b/src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugView.xaml new file mode 100644 index 000000000..67230820c --- /dev/null +++ b/src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugView.xaml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugViewModel.cs b/src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugViewModel.cs similarity index 90% rename from src/Artemis.UI/Screens/Settings/Debug/DeviceDebugViewModel.cs rename to src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugViewModel.cs index 0eac26446..8bb4e6266 100644 --- a/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugViewModel.cs @@ -2,9 +2,12 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Linq; using System.Xml.Serialization; using Artemis.Core; using Artemis.Core.Services; +using Artemis.UI.Ninject.Factories; +using Artemis.UI.Screens.Shared; using Artemis.UI.Shared.Services; using Ookii.Dialogs.Wpf; using RGB.NET.Layout; @@ -14,24 +17,30 @@ using Stylet; namespace Artemis.UI.Screens.Settings.Debug { - public class DeviceDebugViewModel : Screen + public class DeviceDebugViewModel : Conductor.Collection.OneActive { private readonly IDeviceService _deviceService; private readonly IDialogService _dialogService; private readonly IRgbService _rgbService; private ArtemisLed _selectedLed; - public DeviceDebugViewModel(ArtemisDevice device, IDeviceService deviceService, IRgbService rgbService, IDialogService dialogService) + public DeviceDebugViewModel(ArtemisDevice device, IDeviceService deviceService, IRgbService rgbService, IDialogService dialogService, IDeviceDebugVmFactory factory) { _deviceService = deviceService; _rgbService = rgbService; _dialogService = dialogService; + Device = device; + PanZoomViewModel = new PanZoomViewModel(); + + Items.Add(factory.DevicePropertiesTabViewModel(device)); + Items.Add(factory.DeviceLedsTabViewModel(device)); + ActiveItem = Items.First(); } - public List SelectedLeds => SelectedLed != null ? new List {SelectedLed} : null; public ArtemisDevice Device { get; } - + public PanZoomViewModel PanZoomViewModel { get; } + public ArtemisLed SelectedLed { get => _selectedLed; @@ -41,6 +50,7 @@ namespace Artemis.UI.Screens.Settings.Debug NotifyOfPropertyChange(nameof(SelectedLeds)); } } + public List SelectedLeds => SelectedLed != null ? new List { SelectedLed } : null; public bool CanOpenImageDirectory => Device.Layout?.Image != null; @@ -135,7 +145,7 @@ namespace Artemis.UI.Screens.Settings.Debug foreach (ArtemisLedLayout ledLayout in Device.Layout.Leds) { - if (ledLayout.LayoutCustomLedData.LogicalLayouts == null) + if (ledLayout.LayoutCustomLedData.LogicalLayouts == null) continue; // Only the image of the current logical layout is available as an URI, iterate each layout and find the images manually diff --git a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabView.xaml b/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabView.xaml new file mode 100644 index 000000000..6c67d140b --- /dev/null +++ b/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabView.xaml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabViewModel.cs new file mode 100644 index 000000000..c2339bd93 --- /dev/null +++ b/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabViewModel.cs @@ -0,0 +1,17 @@ +using Artemis.Core; +using Stylet; + +namespace Artemis.UI.Screens.Settings.Debug.Device.Tabs +{ + public class DeviceLedsTabViewModel : Screen + { + + public DeviceLedsTabViewModel(ArtemisDevice device) + { + Device = device; + DisplayName = "LEDS"; + } + + public ArtemisDevice Device { get; } + } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DevicePropertiesTabView.xaml b/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DevicePropertiesTabView.xaml new file mode 100644 index 000000000..a0b12086e --- /dev/null +++ b/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DevicePropertiesTabView.xaml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + Device name + + + + + + + + + + + + + + + Manufacturer + + + + + + + + + + + + + + + Device type + + + + + + + + + + + + + + + Physical layout + + + + + + + + + + + + + + + Device image + + + + + + + + + + + + + + + Size (1px = 1mm) + + + + + + + + + + + + + + Location (1px = 1mm) + + + + + + + + + + + + + + + Rotation (degrees) + + + + + + + + + + + + + + + Logical layout + + + + + + + + + + + + + + + Layout file path + + + + + + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DevicePropertiesTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DevicePropertiesTabViewModel.cs new file mode 100644 index 000000000..450ed4617 --- /dev/null +++ b/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DevicePropertiesTabViewModel.cs @@ -0,0 +1,16 @@ +using Artemis.Core; +using Stylet; + +namespace Artemis.UI.Screens.Settings.Debug.Device.Tabs +{ + public class DevicePropertiesTabViewModel : Screen + { + public DevicePropertiesTabViewModel(ArtemisDevice device) + { + Device = device; + DisplayName = "PROPERTIES"; + } + + public ArtemisDevice Device { get; } + } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugView.xaml b/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugView.xaml deleted file mode 100644 index 80dc57da4..000000000 --- a/src/Artemis.UI/Screens/Settings/Debug/DeviceDebugView.xaml +++ /dev/null @@ -1,310 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - Device type - - - - - - - - - - - - - - - Physical layout - - - - - - - - - - - - - - - Device image - - - - - - - - - - - - - - - Size (1px = 1mm) - - - - - - - - - - - - - - Location (1px = 1mm) - - - - - - - - - - - - - - - Rotation (degrees) - - - - - - - - - - - - - - - Logical layout - - - - - - - - - - - - - - - Layout file path - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsViewModel.cs index f9de3cfe3..0dfa5effc 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsViewModel.cs @@ -62,7 +62,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices public void ShowDeviceDebugger() { - _windowManager.ShowWindow(_deviceDebugVmFactory.Create(Device)); + _windowManager.ShowWindow(_deviceDebugVmFactory.DeviceDebugViewModel(Device)); } public void OpenPluginDirectory() diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.xaml b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.xaml index 6cbafa329..0101d01e4 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.xaml +++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.xaml @@ -201,6 +201,18 @@ + + + + + Show random device colors + + + + +