Plugins - Don't dispose Plugin when disabling after it has been injected into a feature

This commit is contained in:
Robert committed 2022-07-22 23:25:35 +02:00
1 parent 75d85985a9
commit 289a411545
9 files changed
+58 -33

No files matched your search

@@ -97,7 +97,7 @@ namespace Artemis.UI.Shared
/// Occurs when a LED of the device has been clicked
/// </summary>
public event EventHandler<LedClickedEventArgs>? LedClicked;
/// <summary>
/// Occurs when the device was clicked but not on a LED.
/// </summary>
@@ -259,8 +259,6 @@ namespace Artemis.UI.Shared
private void SetupForDevice()
{
_deviceImage?.Dispose();
_deviceImage = null;
_highlightedLeds = new List<DeviceVisualizerLed>();
_dimmedLeds = new List<DeviceVisualizerLed>();
@@ -296,7 +294,11 @@ namespace Artemis.UI.Shared
Task.Run(() =>
{
if (device.Layout?.Image == null || !File.Exists(device.Layout.Image.LocalPath))
{
_deviceImage?.Dispose();
_deviceImage = null;
return;
}
try
{
@@ -312,6 +314,7 @@ namespace Artemis.UI.Shared
deviceVisualizerLed.DrawBitmap(context);
}
_deviceImage?.Dispose();
_deviceImage = renderTargetBitmap;
Dispatcher.UIThread.Post(InvalidateMeasure);
@@ -337,7 +340,5 @@ namespace Artemis.UI.Shared
}
#endregion
}
}
@@ -44,6 +44,10 @@
<ToggleButton Classes="icon-button">
<avalonia:MaterialIcon Kind="BlockChain" />
</ToggleButton>
<Button Classes="icon-button">
<avalonia:MaterialIcon Kind="Cog" />
</Button>
</StackPanel>
</Border>
</Design.PreviewWith>