Device visualizer - Clear device cache on UI thread on property change

Surface editor - Don't quietly fail device updates
This commit is contained in:
Robert committed 2023-07-09 08:29:54 +02:00
1 parent 850038ffd1
commit af1920141c
2 files changed
+10 -3

No files matched your search

@@ -197,9 +197,12 @@ public class DeviceVisualizer : Control
private void DevicePropertyChanged(object? sender, PropertyChangedEventArgs e) private void DevicePropertyChanged(object? sender, PropertyChangedEventArgs e)
{ {
if (Device != null) Dispatcher.UIThread.Invoke(async () =>
BitmapCache.Remove(Device); {
Dispatcher.UIThread.Invoke(SetupForDevice, DispatcherPriority.Background); if (Device != null)
BitmapCache.Remove(Device);
await SetupForDevice();
}, DispatcherPriority.Background);
} }
private void DeviceUpdated(object? sender, EventArgs e) private void DeviceUpdated(object? sender, EventArgs e)
@@ -136,6 +136,10 @@ public class SurfaceEditorViewModel : ActivatableViewModelBase, IMainScreenViewM
_saving = true; _saving = true;
_rgbService.SaveDevices(); _rgbService.SaveDevices();
} }
catch (Exception e)
{
_windowService.ShowExceptionDialog("Failed to update device positions", e);
}
finally finally
{ {
_saving = false; _saving = false;