Skip to content

A Swiss Army knife for developers.

Fixed bug: Smart detection when dialog opened (#1027)

Etienne BAUDOUX8672ee1dc415
diff --git a/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs b/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs
index 7d1709fcf..c8b5074b3 100644
--- a/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs
+++ b/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs
@@ -89,7 +89,7 @@ public partial class Index : MefComponentBase
StateHasChanged();
// Start Smart Detection
- ViewModel.RunSmartDetectionAsync(WindowService.IsCompactOverlayMode)
+ ViewModel.RunSmartDetectionAsync(WindowService.IsCompactOverlayMode, DialogService.IsDialogOpened)
.ContinueWith(async _ =>
{
await InvokeAsync(StateHasChanged);
@@ -161,7 +161,7 @@ public partial class Index : MefComponentBase
_navBar.TryFocusSearchBoxAsync();
// Start Smart Detection
- ViewModel.RunSmartDetectionAsync(WindowService.IsCompactOverlayMode).Forget();
+ ViewModel.RunSmartDetectionAsync(WindowService.IsCompactOverlayMode, DialogService.IsDialogOpened).Forget();
}
if (IsTransitioning)
diff --git a/src/app/dev/DevToys.Business/ViewModels/MainWindowViewModel.cs b/src/app/dev/DevToys.Business/ViewModels/MainWindowViewModel.cs
index bcfece900..d3012d27c 100644
--- a/src/app/dev/DevToys.Business/ViewModels/MainWindowViewModel.cs
+++ b/src/app/dev/DevToys.Business/ViewModels/MainWindowViewModel.cs
@@ -204,9 +204,11 @@ internal sealed partial class MainWindowViewModel : ObservableRecipient
/// <summary>
/// Get the data from the clipboard and try to detect tools that can accept the clipboard data as an input.
/// </summary>
- internal async Task RunSmartDetectionAsync(bool isInCompactOverlayMode)
+ internal async Task RunSmartDetectionAsync(bool isInCompactOverlayMode, bool isDialogOpened)
{
- if (isInCompactOverlayMode || !_settingsProvider.GetSetting(PredefinedSettings.SmartDetection))
+ if (isInCompactOverlayMode
+ || isDialogOpened
+ || !_settingsProvider.GetSetting(PredefinedSettings.SmartDetection))
{
return;
}