From 67268284e0e4ae612a5395973a58b6674b203c4f Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Mon, 7 Apr 2025 14:40:27 +0800 Subject: [PATCH] Support numerical box for search delay --- .../Controls/InstalledPluginDisplay.xaml | 3 ++- Flow.Launcher/ViewModel/PluginViewModel.cs | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml index 778f00160..f57c0e2d9 100644 --- a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml +++ b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml @@ -91,7 +91,8 @@ Maximum="1000" Minimum="0" SpinButtonPlacementMode="Inline" - ToolTip="{DynamicResource searchDelayToolTip}" /> + ToolTip="{DynamicResource searchDelayToolTip}" + Value="{Binding PluginSearchDelayTime, Mode=TwoWay}" /> diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 22a69592b..2dff72ac5 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -93,13 +93,23 @@ namespace Flow.Launcher.ViewModel } } - public int? PluginSearchDelayTime + public double PluginSearchDelayTime { - get => PluginPair.Metadata.SearchDelayTime; + get => PluginPair.Metadata.SearchDelayTime == null ? + double.NaN : + PluginPair.Metadata.SearchDelayTime.Value; set { - PluginPair.Metadata.SearchDelayTime = value; - PluginSettingsObject.SearchDelayTime = value; + if (double.IsNaN(value)) + { + PluginPair.Metadata.SearchDelayTime = null; + PluginSettingsObject.SearchDelayTime = null; + } + else + { + PluginPair.Metadata.SearchDelayTime = (int)value; + PluginSettingsObject.SearchDelayTime = (int)value; + } } }