Disable search delay number box when search delay is disabled

This commit is contained in:
Jack251970 2025-04-08 21:02:42 +08:00
parent 970bb3ac12
commit 61fa4602d5
2 changed files with 10 additions and 4 deletions

View file

@ -90,13 +90,14 @@
<ui:NumberBox
Width="160"
Margin="0 0 8 0"
IsEnabled="{Binding SearchDelayEnabled}"
Maximum="1000"
SmallChange="10"
Minimum="0"
SpinButtonPlacementMode="Compact" PlaceholderText="{DynamicResource searchDelayPlaceHolder}"
PlaceholderText="{DynamicResource searchDelayPlaceHolder}"
SmallChange="10"
SpinButtonPlacementMode="Compact"
ToolTip="{DynamicResource searchDelayToolTip}"
Value="{Binding PluginSearchDelayTime, Mode=TwoWay}">
</ui:NumberBox>
Value="{Binding PluginSearchDelayTime, Mode=TwoWay}" />
</StackPanel>
<!-- Put OnOffControl after PriorityControl & SearchDelayControl so that it can display correctly -->

View file

@ -3,9 +3,11 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Input;
using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Infrastructure.Image;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Resources.Controls;
@ -13,6 +15,8 @@ namespace Flow.Launcher.ViewModel
{
public partial class PluginViewModel : BaseModel
{
private static readonly Settings Settings = Ioc.Default.GetRequiredService<Settings>();
private readonly PluginPair _pluginPair;
public PluginPair PluginPair
{
@ -148,6 +152,7 @@ namespace Flow.Launcher.ViewModel
App.API.GetTranslation("default") :
App.API.GetTranslation($"SearchDelayTime{PluginPair.Metadata.SearchDelayTime}");
public Infrastructure.UserSettings.Plugin PluginSettingsObject{ get; init; }
public bool SearchDelayEnabled => Settings.SearchQueryResultsWithDelay;
public void OnActionKeywordsChanged()
{