diff --git a/src/Artemis.Core/Services/RgbService.cs b/src/Artemis.Core/Services/RgbService.cs
index 30e359658..6d322b8d0 100644
--- a/src/Artemis.Core/Services/RgbService.cs
+++ b/src/Artemis.Core/Services/RgbService.cs
@@ -197,7 +197,7 @@ namespace Artemis.Core.Services
public ArtemisLayout ApplyBestDeviceLayout(ArtemisDevice device)
{
ArtemisLayout layout;
-
+
// Configured layout path takes precedence over all other options
if (device.CustomLayoutPath != null)
{
@@ -239,6 +239,7 @@ namespace Artemis.Core.Services
public void ApplyDeviceLayout(ArtemisDevice device, ArtemisLayout layout, bool createMissingLeds, bool removeExessiveLeds)
{
device.ApplyLayout(layout, createMissingLeds, removeExessiveLeds);
+ UpdateLedGroup();
}
public ArtemisDevice? GetDevice(IRGBDevice rgbDevice)
diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs
index 35adaf092..640812016 100644
--- a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs
+++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs
@@ -17,7 +17,7 @@ namespace Artemis.UI.Shared
private SolidColorBrush? _renderColorBrush;
private Color _renderColor;
-
+
public DeviceVisualizerLed(ArtemisLed led)
{
Led = led;
@@ -51,7 +51,7 @@ namespace Artemis.UI.Shared
byte g = Led.RgbLed.Color.GetG();
byte b = Led.RgbLed.Color.GetB();
- _renderColor.A = (byte)(isDimmed ? 100 : 255);
+ _renderColor.A = (byte) (isDimmed ? 100 : 255);
_renderColor.A = isDimmed ? Dimmed : NonDimmed;
_renderColor.R = r;
_renderColor.G = g;
@@ -135,6 +135,8 @@ namespace Artemis.UI.Shared
{
try
{
+ double width = Led.RgbLed.Size.Width - deflateAmount;
+ double height = Led.RgbLed.Size.Height - deflateAmount;
// DisplayGeometry = Geometry.Parse(Led.RgbLed.ShapeData);
DisplayGeometry = Geometry.Combine(
Geometry.Empty,
@@ -144,11 +146,27 @@ namespace Artemis.UI.Shared
{
Children = new TransformCollection
{
- new ScaleTransform(Led.RgbLed.Size.Width - deflateAmount, Led.RgbLed.Size.Height - deflateAmount),
+ new ScaleTransform(width, height),
new TranslateTransform(deflateAmount / 2, deflateAmount / 2)
}
}
);
+
+ if (DisplayGeometry.Bounds.Width > width)
+ {
+ DisplayGeometry = Geometry.Combine(Geometry.Empty, DisplayGeometry, GeometryCombineMode.Union, new TransformGroup
+ {
+ Children = new TransformCollection {new ScaleTransform(width / DisplayGeometry.Bounds.Width, 1)}
+ });
+ }
+
+ if (DisplayGeometry.Bounds.Height > height)
+ {
+ DisplayGeometry = Geometry.Combine(Geometry.Empty, DisplayGeometry, GeometryCombineMode.Union, new TransformGroup
+ {
+ Children = new TransformCollection {new ScaleTransform(1, height / DisplayGeometry.Bounds.Height)}
+ });
+ }
}
catch (Exception)
{
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs
index 55ac8e376..f7ead0cbb 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Timers;
@@ -139,7 +140,11 @@ namespace Artemis.UI.Shared.Input
set
{
if (!SetAndNotify(ref _isDataModelViewModelOpen, value)) return;
- if (value) UpdateDataModelVisualization();
+ if (value)
+ {
+ UpdateDataModelVisualization();
+ OpenSelectedValue(DataModelViewModel);
+ }
}
}
@@ -303,6 +308,21 @@ namespace Artemis.UI.Shared.Input
extraDataModelViewModel.Update(_dataModelUIService, new DataModelUpdateConfiguration(LoadEventChildren));
}
+ private void OpenSelectedValue(DataModelVisualizationViewModel dataModelPropertiesViewModel)
+ {
+ if (DataModelPath == null)
+ return;
+
+ if (dataModelPropertiesViewModel.Children.Any(c => c.DataModelPath != null && DataModelPath.Path.StartsWith(c.DataModelPath.Path)))
+ {
+ dataModelPropertiesViewModel.IsVisualizationExpanded = true;
+ foreach (DataModelVisualizationViewModel dataModelVisualizationViewModel in dataModelPropertiesViewModel.Children)
+ {
+ OpenSelectedValue(dataModelVisualizationViewModel);
+ }
+ }
+ }
+
#endregion
#region Events
diff --git a/src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml b/src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml
index 7b82c904e..9e8dc0c23 100644
--- a/src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml
+++ b/src/Artemis.UI/Screens/Settings/Device/DeviceDialogView.xaml
@@ -24,110 +24,124 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Settings/Device/DeviceDialogViewModel.cs b/src/Artemis.UI/Screens/Settings/Device/DeviceDialogViewModel.cs
index 97d3ce8fb..c1472c721 100644
--- a/src/Artemis.UI/Screens/Settings/Device/DeviceDialogViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/Device/DeviceDialogViewModel.cs
@@ -9,6 +9,7 @@ using Artemis.Core.Services;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.Shared;
using Artemis.UI.Shared.Services;
+using MaterialDesignThemes.Wpf;
using Ookii.Dialogs.Wpf;
using RGB.NET.Layout;
using Stylet;
@@ -21,6 +22,7 @@ namespace Artemis.UI.Screens.Settings.Device
private readonly IDialogService _dialogService;
private readonly IRgbService _rgbService;
private ArtemisLed _selectedLed;
+ private SnackbarMessageQueue _deviceMessageQueue;
public DeviceDialogViewModel(ArtemisDevice device, IDeviceService deviceService, IRgbService rgbService, IDialogService dialogService, IDeviceDebugVmFactory factory)
{
@@ -38,9 +40,28 @@ namespace Artemis.UI.Screens.Settings.Device
DisplayName = $"{device.RgbDevice.DeviceInfo.Model} | Artemis";
}
+ protected override void OnInitialActivate()
+ {
+ DeviceMessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(5));
+ Device.DeviceUpdated += DeviceOnDeviceUpdated;
+ base.OnInitialActivate();
+ }
+
+ protected override void OnClose()
+ {
+ Device.DeviceUpdated -= DeviceOnDeviceUpdated;
+ base.OnClose();
+ }
+
public ArtemisDevice Device { get; }
public PanZoomViewModel PanZoomViewModel { get; }
-
+
+ public SnackbarMessageQueue DeviceMessageQueue
+ {
+ get => _deviceMessageQueue;
+ set => SetAndNotify(ref _deviceMessageQueue, value);
+ }
+
public ArtemisLed SelectedLed
{
get => _selectedLed;
@@ -50,7 +71,10 @@ namespace Artemis.UI.Screens.Settings.Device
NotifyOfPropertyChange(nameof(SelectedLeds));
}
}
- public List SelectedLeds => SelectedLed != null ? new List { SelectedLed } : null;
+
+ public bool CanExportLayout => Device.Layout?.IsValid ?? false;
+
+ public List SelectedLeds => SelectedLed != null ? new List {SelectedLed} : null;
public bool CanOpenImageDirectory => Device.Layout?.Image != null;
@@ -165,5 +189,14 @@ namespace Artemis.UI.Screens.Settings.Device
#endregion
// ReSharper restore UnusedMember.Global
+
+ #region Event handlers
+
+ private void DeviceOnDeviceUpdated(object? sender, EventArgs e)
+ {
+ NotifyOfPropertyChange(nameof(CanExportLayout));
+ }
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceInfoTabView.xaml b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceInfoTabView.xaml
index 5b4ce48a4..3f5047fb9 100644
--- a/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceInfoTabView.xaml
+++ b/src/Artemis.UI/Screens/Settings/Device/Tabs/DeviceInfoTabView.xaml
@@ -91,15 +91,21 @@
- Layout file path
-