From 7a806c8f2e52eaabd0c5c8974b49e96552885873 Mon Sep 17 00:00:00 2001 From: hexawyz <8518235+hexawyz@users.noreply.github.com> Date: Sun, 9 Feb 2025 02:55:17 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Disable=20embedded=20monitor=20U?= =?UTF-8?q?I=20during=20updates.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EmbeddedMonitorDeviceSettingsControl.xaml | 2 +- .../EmbeddedMonitorFeaturesViewModel.cs | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Exo/Ui/Exo.Settings.Ui/EmbeddedMonitorDeviceSettingsControl.xaml b/src/Exo/Ui/Exo.Settings.Ui/EmbeddedMonitorDeviceSettingsControl.xaml index 6d4d61d8..cacecd49 100644 --- a/src/Exo/Ui/Exo.Settings.Ui/EmbeddedMonitorDeviceSettingsControl.xaml +++ b/src/Exo/Ui/Exo.Settings.Ui/EmbeddedMonitorDeviceSettingsControl.xaml @@ -17,7 +17,7 @@ - + diff --git a/src/Exo/Ui/Exo.Settings.Ui/ViewModels/EmbeddedMonitorFeaturesViewModel.cs b/src/Exo/Ui/Exo.Settings.Ui/ViewModels/EmbeddedMonitorFeaturesViewModel.cs index 18b6c87b..2adff1ae 100644 --- a/src/Exo/Ui/Exo.Settings.Ui/ViewModels/EmbeddedMonitorFeaturesViewModel.cs +++ b/src/Exo/Ui/Exo.Settings.Ui/ViewModels/EmbeddedMonitorFeaturesViewModel.cs @@ -129,6 +129,7 @@ internal sealed class EmbeddedMonitorViewModel : ApplicableResettableBindableObj private readonly ReadOnlyObservableCollection _readOnlySupportedGraphics; private Guid _initialCurrentGraphicsId; private EmbeddedMonitorGraphicsViewModel? _currentGraphics; + private bool _isReady; public EmbeddedMonitorViewModel(EmbeddedMonitorFeaturesViewModel owner, EmbeddedMonitorInformation information) { @@ -157,12 +158,19 @@ public EmbeddedMonitorViewModel(EmbeddedMonitorFeaturesViewModel owner, Embedded _currentGraphics = imageGraphics ?? _supportedGraphics[0]; _initialCurrentGraphicsId = _currentGraphics.Id; } + _isReady = true; } private bool IsChangedNonRecursive => _currentGraphics?.Id != _initialCurrentGraphicsId; public override bool IsChanged => IsChangedNonRecursive || CurrentGraphics?.IsChanged == true; protected override bool CanApply => IsChanged && _currentGraphics?.IsValid == true; + public bool IsNotBusy + { + get => _isReady; + private set => SetValue(ref _isReady, value, ChangedProperty.IsNotBusy); + } + public Guid MonitorId => _monitorId; public MonitorShape Shape @@ -256,7 +264,15 @@ protected override async Task ApplyChangesAsync(CancellationToken cancellationTo { if (_currentGraphics is not null) { - await _currentGraphics.ApplyAsync(cancellationToken).ConfigureAwait(false); + IsNotBusy = false; + try + { + await _currentGraphics.ApplyAsync(cancellationToken); + } + finally + { + IsNotBusy = true; + } } } @@ -373,7 +389,7 @@ internal override async ValueTask ApplyAsync(CancellationToken cancellationToken GraphicsId = Id }, cancellationToken - ).ConfigureAwait(false); + ); } internal sealed class EmbeddedMonitorImageGraphicsViewModel : EmbeddedMonitorGraphicsViewModel, IDisposable