mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-01-02 10:43:31 +00:00
Prevented an possible deadlock when moving devices in the surface editor
This commit is contained in:
parent
dc8ca8ee95
commit
c5219bd224
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
@ -29,6 +30,7 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
private BitmapImage _deviceImage;
|
private BitmapImage _deviceImage;
|
||||||
private bool _subscribed;
|
private bool _subscribed;
|
||||||
private ArtemisDevice _oldDevice;
|
private ArtemisDevice _oldDevice;
|
||||||
|
private Task _lastRenderTask;
|
||||||
|
|
||||||
public DeviceVisualizer()
|
public DeviceVisualizer()
|
||||||
{
|
{
|
||||||
@ -209,11 +211,13 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
|
|
||||||
private void RgbSurfaceOnUpdated(UpdatedEventArgs e)
|
private void RgbSurfaceOnUpdated(UpdatedEventArgs e)
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
_lastRenderTask?.Wait();
|
||||||
|
|
||||||
|
_lastRenderTask = Dispatcher.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
if (ShowColors && Visibility == Visibility.Visible)
|
if (ShowColors && Visibility == Visibility.Visible)
|
||||||
Render();
|
Render();
|
||||||
});
|
}).Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Render()
|
private void Render()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user