diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index eeea0fab8..b93053583 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -45,7 +45,7 @@ public class DeviceVisualizer : Control /// public override void Render(DrawingContext drawingContext) { - if (Device == null || _deviceBounds.Width == 0 || _deviceBounds.Height == 0) + if (Device == null || _deviceBounds.Width == 0 || _deviceBounds.Height == 0 || _loading) return; // Determine the scale required to fit the desired size of the control @@ -208,6 +208,8 @@ public class DeviceVisualizer : Control public static readonly StyledProperty?> HighlightedLedsProperty = AvaloniaProperty.Register?>(nameof(HighlightedLeds)); + private bool _loading; + /// /// Gets or sets a list of LEDs to highlight /// @@ -273,6 +275,7 @@ public class DeviceVisualizer : Control return; _deviceBounds = MeasureDevice(); + _loading = true; Device.RgbDevice.PropertyChanged += DevicePropertyChanged; Device.DeviceUpdated += DeviceUpdated; @@ -288,15 +291,15 @@ public class DeviceVisualizer : Control ArtemisDevice? device = Device; Dispatcher.UIThread.Post(() => { - if (device.Layout?.Image == null || !File.Exists(device.Layout.Image.LocalPath)) - { - _deviceImage?.Dispose(); - _deviceImage = null; - return; - } - try { + if (device.Layout?.Image == null || !File.Exists(device.Layout.Image.LocalPath)) + { + _deviceImage?.Dispose(); + _deviceImage = null; + return; + } + // Create a bitmap that'll be used to render the device and LED images just once // Render 4 times the actual size of the device to make sure things look sharp when zoomed in RenderTargetBitmap renderTargetBitmap = new(new PixelSize((int) device.RgbDevice.ActualSize.Width * 2, (int) device.RgbDevice.ActualSize.Height * 2)); @@ -314,12 +317,16 @@ public class DeviceVisualizer : Control _deviceImage?.Dispose(); _deviceImage = renderTargetBitmap; - Dispatcher.UIThread.Post(InvalidateMeasure); + InvalidateMeasure(); } catch (Exception) { // ignored } + finally + { + _loading = false; + } }); } diff --git a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml index 1a576793c..d8506a89d 100644 --- a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml +++ b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml @@ -156,7 +156,21 @@ Release notes - + + + + + + + diff --git a/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs index 9612e2fb7..816ad4343 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs @@ -50,7 +50,6 @@ public class NodePickerViewModel : ActivatableViewModelBase this.WhenActivated(d => { SearchText = null; - TargetPin = null; nodeSourceList.Edit(list => { @@ -59,7 +58,11 @@ public class NodePickerViewModel : ActivatableViewModelBase }); IsVisible = true; - Disposable.Create(() => IsVisible = false).DisposeWith(d); + Disposable.Create(() => + { + IsVisible = false; + TargetPin = null; + }).DisposeWith(d); }); } @@ -102,6 +105,7 @@ public class NodePickerViewModel : ActivatableViewModelBase node.Y = Math.Round(Position.Y / 10d, 0, MidpointRounding.AwayFromZero) * 10d; if (TargetPin != null) + { using (_nodeEditorService.CreateCommandScope(_nodeScript, "Create node for pin")) { _nodeEditorService.ExecuteCommand(_nodeScript, new AddNode(_nodeScript, node)); @@ -114,6 +118,7 @@ public class NodePickerViewModel : ActivatableViewModelBase if (source != null) _nodeEditorService.ExecuteCommand(_nodeScript, new ConnectPins(source, TargetPin)); } + } else _nodeEditorService.ExecuteCommand(_nodeScript, new AddNode(_nodeScript, node)); } diff --git a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml index ba18c0cf0..de10ffaa4 100644 --- a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml @@ -44,12 +44,10 @@ - - - - - + + +