diff --git a/src/Artemis.UI/Converters/UriToFileNameConverter.cs b/src/Artemis.UI/Converters/UriToFileNameConverter.cs
new file mode 100644
index 000000000..435c1fec5
--- /dev/null
+++ b/src/Artemis.UI/Converters/UriToFileNameConverter.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Globalization;
+using System.IO;
+using System.Windows.Data;
+
+namespace Artemis.UI.Converters
+{
+ public class UriToFileNameConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is Uri uri && uri.IsFile)
+ return Path.GetFileName(uri.LocalPath);
+ return null;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return Binding.DoNothing;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Ninject/Factories/IVMFactory.cs b/src/Artemis.UI/Ninject/Factories/IVMFactory.cs
index 1fc61d300..8dd40960e 100644
--- a/src/Artemis.UI/Ninject/Factories/IVMFactory.cs
+++ b/src/Artemis.UI/Ninject/Factories/IVMFactory.cs
@@ -15,7 +15,8 @@ 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.Device;
+using Artemis.UI.Screens.Settings.Device.Tabs;
using Artemis.UI.Screens.Settings.Tabs.Devices;
using Artemis.UI.Screens.Settings.Tabs.Plugins;
using Artemis.UI.Screens.Shared;
@@ -44,8 +45,9 @@ namespace Artemis.UI.Ninject.Factories
public interface IDeviceDebugVmFactory : IVmFactory
{
- DeviceDebugViewModel DeviceDebugViewModel(ArtemisDevice device);
+ DeviceDialogViewModel DeviceDialogViewModel(ArtemisDevice device);
DevicePropertiesTabViewModel DevicePropertiesTabViewModel(ArtemisDevice device);
+ DeviceInfoTabViewModel DeviceInfoTabViewModel(ArtemisDevice device);
DeviceLedsTabViewModel DeviceLedsTabViewModel(ArtemisDevice device);
}
diff --git a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DevicePropertiesTabView.xaml b/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DevicePropertiesTabView.xaml
deleted file mode 100644
index a0b12086e..000000000
--- a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DevicePropertiesTabView.xaml
+++ /dev/null
@@ -1,197 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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
deleted file mode 100644
index 450ed4617..000000000
--- a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DevicePropertiesTabViewModel.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-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/Device/DeviceDebugView.xaml b/src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml
similarity index 94%
rename from src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugView.xaml
rename to src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml
index 67230820c..7b82c904e 100644
--- a/src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugView.xaml
+++ b/src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml
@@ -1,4 +1,4 @@
-
@@ -80,7 +79,7 @@
-
+
diff --git a/src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugViewModel.cs b/src/Artemis.UI/Screens/Settings/Device/DeviceDialogViewModel.cs
similarity index 93%
rename from src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugViewModel.cs
rename to src/Artemis.UI/Screens/Settings/Device/DeviceDialogViewModel.cs
index 8bb4e6266..97d3ce8fb 100644
--- a/src/Artemis.UI/Screens/Settings/Debug/Device/DeviceDebugViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/Device/DeviceDialogViewModel.cs
@@ -13,18 +13,16 @@ using Ookii.Dialogs.Wpf;
using RGB.NET.Layout;
using Stylet;
-// using PropertyChanged;
-
-namespace Artemis.UI.Screens.Settings.Debug
+namespace Artemis.UI.Screens.Settings.Device
{
- public class DeviceDebugViewModel : Conductor.Collection.OneActive
+ public class DeviceDialogViewModel : 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, IDeviceDebugVmFactory factory)
+ public DeviceDialogViewModel(ArtemisDevice device, IDeviceService deviceService, IRgbService rgbService, IDialogService dialogService, IDeviceDebugVmFactory factory)
{
_deviceService = deviceService;
_rgbService = rgbService;
@@ -34,8 +32,10 @@ namespace Artemis.UI.Screens.Settings.Debug
PanZoomViewModel = new PanZoomViewModel();
Items.Add(factory.DevicePropertiesTabViewModel(device));
+ Items.Add(factory.DeviceInfoTabViewModel(device));
Items.Add(factory.DeviceLedsTabViewModel(device));
ActiveItem = Items.First();
+ DisplayName = $"{device.RgbDevice.DeviceInfo.Model} | Artemis";
}
public ArtemisDevice Device { get; }
diff --git a/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceInfoTabView.xaml b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceInfoTabView.xaml
new file mode 100644
index 000000000..5b4ce48a4
--- /dev/null
+++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceInfoTabView.xaml
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Device name
+
+
+
+ Manufacturer
+
+
+
+
+ Device type
+
+
+
+
+ Physical layout
+
+
+
+
+
+ Size (1px = 1mm)
+
+
+
+ Location (1px = 1mm)
+
+
+
+ Rotation (degrees)
+
+
+
+
+ Logical layout
+
+
+
+
+
+
+
+
+
+
+
+
+ Layout file path
+
+
+
+
+
+
+
+
+
+
+ Image file path
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceInfoTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceInfoTabViewModel.cs
new file mode 100644
index 000000000..dcd976f96
--- /dev/null
+++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceInfoTabViewModel.cs
@@ -0,0 +1,18 @@
+using Artemis.Core;
+using RGB.NET.Core;
+using Stylet;
+
+namespace Artemis.UI.Screens.Settings.Device.Tabs
+{
+ public class DeviceInfoTabViewModel : Screen
+ {
+ public DeviceInfoTabViewModel(ArtemisDevice device)
+ {
+ Device = device;
+ DisplayName = "INFO";
+ }
+
+ public bool IsKeyboard => Device.RgbDevice is IKeyboard;
+ public ArtemisDevice Device { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabView.xaml b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceLedsTabView.xaml
similarity index 53%
rename from src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabView.xaml
rename to src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceLedsTabView.xaml
index 6c67d140b..37831d39b 100644
--- a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabView.xaml
+++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceLedsTabView.xaml
@@ -1,31 +1,34 @@
-
+ d:DataContext="{d:DesignInstance {x:Type tabs:DeviceLedsTabViewModel}}">
+
+
+
-
+ d:DataContext="{d:DesignInstance Type={x:Type core:ArtemisLed}}"
+ CanUserSortColumns="True"
+ IsReadOnly="True"
+ CanUserAddRows="False"
+ AutoGenerateColumns="False"
+ materialDesign:DataGridAssist.CellPadding="13 8 8 8"
+ materialDesign:DataGridAssist.ColumnHeaderPadding="8"
+ SelectedItem="{Binding Parent.SelectedLed}"
+ CanUserResizeRows="False"
+ Margin="10">
-
+
diff --git a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceLedsTabViewModel.cs
similarity index 83%
rename from src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabViewModel.cs
rename to src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceLedsTabViewModel.cs
index c2339bd93..d57f8cb1a 100644
--- a/src/Artemis.UI/Screens/Settings/Debug/Device/Tabs/DeviceLedsTabViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceLedsTabViewModel.cs
@@ -1,7 +1,7 @@
using Artemis.Core;
using Stylet;
-namespace Artemis.UI.Screens.Settings.Debug.Device.Tabs
+namespace Artemis.UI.Screens.Settings.Device.Tabs
{
public class DeviceLedsTabViewModel : Screen
{
diff --git a/src/Artemis.UI/Screens/Settings/Device/Tabs/DevicePropertiesTabView.xaml b/src/Artemis.UI/Screens/Settings/Device/Tabs/DevicePropertiesTabView.xaml
new file mode 100644
index 000000000..56da0c5bd
--- /dev/null
+++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/DevicePropertiesTabView.xaml
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Surface properties
+
+
+
+
+
+
+
+
+
+
+
+
+ Color calibration
+
+
+
+ Use the sliders below to adjust the colors of your device so that it matches your other devices.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Custom layout
+
+
+ Select a custom layout below if you want to change the appearance and/or LEDs of this device.
+
+
+
+
+
+
+ Layout path
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs b/src/Artemis.UI/Screens/Settings/Device/Tabs/DevicePropertiesTabViewModel.cs
similarity index 85%
rename from src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs
rename to src/Artemis.UI/Screens/Settings/Device/Tabs/DevicePropertiesTabViewModel.cs
index ad06f0ca0..42fffa621 100644
--- a/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/DevicePropertiesTabViewModel.cs
@@ -5,68 +5,46 @@ using System.Windows.Input;
using Artemis.Core;
using Artemis.Core.Services;
using Artemis.UI.Shared.Services;
-using MaterialDesignThemes.Wpf;
using Ookii.Dialogs.Wpf;
using SkiaSharp;
using Stylet;
-namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
+namespace Artemis.UI.Screens.Settings.Device.Tabs
{
- public class SurfaceDeviceConfigViewModel : DialogViewModelBase
+ public class DevicePropertiesTabViewModel : Screen
{
private readonly ICoreService _coreService;
- private readonly IRgbService _rgbService;
private readonly IMessageService _messageService;
- private readonly double _initialRedScale;
- private readonly double _initialGreenScale;
- private readonly double _initialBlueScale;
+ private readonly IRgbService _rgbService;
+ private double _blueScale;
+ private SKColor _currentColor;
+ private bool _displayOnDevices;
+ private double _greenScale;
+ private double _initialBlueScale;
+ private double _initialGreenScale;
+ private double _initialRedScale;
+ private double _redScale;
private int _rotation;
private double _scale;
private int _x;
private int _y;
- private double _redScale;
- private double _greenScale;
- private double _blueScale;
- private SKColor _currentColor;
- private bool _displayOnDevices;
- public SurfaceDeviceConfigViewModel(ArtemisDevice device,
+ public DevicePropertiesTabViewModel(ArtemisDevice device,
ICoreService coreService,
IRgbService rgbService,
IMessageService messageService,
- IModelValidator validator) : base(validator)
+ IModelValidator validator) : base(validator)
{
_coreService = coreService;
_rgbService = rgbService;
_messageService = messageService;
Device = device;
-
- X = (int) Device.X;
- Y = (int) Device.Y;
- Scale = Device.Scale;
- Rotation = (int) Device.Rotation;
- RedScale = Device.RedScale * 100d;
- GreenScale = Device.GreenScale * 100d;
- BlueScale = Device.BlueScale * 100d;
- //we need to store the initial values to be able to restore them when the user clicks "Cancel"
- _initialRedScale = Device.RedScale;
- _initialGreenScale = Device.GreenScale;
- _initialBlueScale = Device.BlueScale;
- CurrentColor = SKColors.White;
- _coreService.FrameRendering += OnFrameRendering;
- Device.PropertyChanged += DeviceOnPropertyChanged;
+ DisplayName = "PROPERTIES";
}
public ArtemisDevice Device { get; }
- public override void OnDialogClosed(object sender, DialogClosingEventArgs e)
- {
- _coreService.FrameRendering -= OnFrameRendering;
- Device.PropertyChanged -= DeviceOnPropertyChanged;
- base.OnDialogClosed(sender, e);
- }
-
public int X
{
get => _x;
@@ -121,27 +99,6 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
set => SetAndNotify(ref _displayOnDevices, value);
}
- public async Task Accept()
- {
- await ValidateAsync();
- if (HasErrors)
- return;
-
- _coreService.ModuleRenderingDisabled = true;
- await Task.Delay(100);
-
- Device.X = X;
- Device.Y = Y;
- Device.Scale = Scale;
- Device.Rotation = Rotation;
- Device.RedScale = RedScale / 100d;
- Device.GreenScale = GreenScale / 100d;
- Device.BlueScale = BlueScale / 100d;
-
- _coreService.ModuleRenderingDisabled = false;
- Session.Close(true);
- }
-
public void ApplyScaling()
{
Device.RedScale = RedScale / 100d;
@@ -169,21 +126,58 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
}
}
- public override void Cancel()
+ public async Task Apply()
+ {
+ await ValidateAsync();
+ if (HasErrors)
+ return;
+
+ _coreService.ModuleRenderingDisabled = true;
+ await Task.Delay(100);
+
+ Device.X = X;
+ Device.Y = Y;
+ Device.Scale = Scale;
+ Device.Rotation = Rotation;
+ Device.RedScale = RedScale / 100d;
+ Device.GreenScale = GreenScale / 100d;
+ Device.BlueScale = BlueScale / 100d;
+
+ _coreService.ModuleRenderingDisabled = false;
+ }
+
+ public void Reset()
{
Device.RedScale = _initialRedScale;
Device.GreenScale = _initialGreenScale;
Device.BlueScale = _initialBlueScale;
-
- base.Cancel();
}
+ protected override void OnActivate()
+ {
+ X = (int) Device.X;
+ Y = (int) Device.Y;
+ Scale = Device.Scale;
+ Rotation = (int) Device.Rotation;
+ RedScale = Device.RedScale * 100d;
+ GreenScale = Device.GreenScale * 100d;
+ BlueScale = Device.BlueScale * 100d;
+ //we need to store the initial values to be able to restore them when the user clicks "Cancel"
+ _initialRedScale = Device.RedScale;
+ _initialGreenScale = Device.GreenScale;
+ _initialBlueScale = Device.BlueScale;
+ CurrentColor = SKColors.White;
+ _coreService.FrameRendering += OnFrameRendering;
+ Device.PropertyChanged += DeviceOnPropertyChanged;
+
+ base.OnActivate();
+ }
+
+ #region Event handlers
+
private void DeviceOnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName == nameof(Device.CustomLayoutPath))
- {
- _rgbService.ApplyBestDeviceLayout(Device);
- }
+ if (e.PropertyName == nameof(Device.CustomLayoutPath)) _rgbService.ApplyBestDeviceLayout(Device);
}
private void OnFrameRendering(object sender, FrameRenderingEventArgs e)
@@ -197,5 +191,7 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
};
e.Canvas.DrawRect(0, 0, e.Canvas.LocalClipBounds.Width, e.Canvas.LocalClipBounds.Height, overlayPaint);
}
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModelValidator.cs b/src/Artemis.UI/Screens/Settings/Device/Tabs/SurfaceDeviceConfigViewModelValidator.cs
similarity index 73%
rename from src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModelValidator.cs
rename to src/Artemis.UI/Screens/Settings/Device/Tabs/SurfaceDeviceConfigViewModelValidator.cs
index 764bb36db..78de61ba7 100644
--- a/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModelValidator.cs
+++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/SurfaceDeviceConfigViewModelValidator.cs
@@ -1,10 +1,10 @@
using FluentValidation;
-namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
+namespace Artemis.UI.Screens.Settings.Device.Tabs
{
- public class SurfaceDeviceConfigViewModelValidator : AbstractValidator
+ public class DevicePropertiesTabViewModelValidator : AbstractValidator
{
- public SurfaceDeviceConfigViewModelValidator()
+ public DevicePropertiesTabViewModelValidator()
{
RuleFor(m => m.X).GreaterThanOrEqualTo(0).WithMessage("X-coordinate must be 0 or greater");
diff --git a/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsView.xaml b/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsView.xaml
index ced4c9131..a6564ec50 100644
--- a/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsView.xaml
+++ b/src/Artemis.UI/Screens/Settings/Tabs/Devices/DeviceSettingsView.xaml
@@ -54,12 +54,6 @@
-