Change search delay time to int & Improve code quality & Improve strings

This commit is contained in:
Jack251970 2025-04-07 14:16:17 +08:00
parent 44f136cca5
commit dc7b812077
17 changed files with 52 additions and 457 deletions

View file

@ -120,10 +120,9 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public int Priority { get; set; } public int Priority { get; set; }
[JsonIgnore] [JsonIgnore]
public SearchDelayTime? DefaultSearchDelayTime { get; set; } public int? DefaultSearchDelayTime { get; set; }
[JsonConverter(typeof(JsonStringEnumConverter))] public int? SearchDelayTime { get; set; }
public SearchDelayTime? SearchDelayTime { get; set; }
/// <summary> /// <summary>
/// Used only to save the state of the plugin in settings /// Used only to save the state of the plugin in settings

View file

@ -322,8 +322,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public bool SearchQueryResultsWithDelay { get; set; } public bool SearchQueryResultsWithDelay { get; set; }
[JsonConverter(typeof(JsonStringEnumConverter))] [JsonIgnore]
public SearchDelayTime SearchDelayTime { get; set; } = SearchDelayTime.Normal; public IEnumerable<int> SearchDelayTimeRange = new List<int> { 50, 100, 150, 200, 250, 300, 350, 400, 450, 500 };
public int SearchDelayTime { get; set; } = 150;
[JsonConverter(typeof(JsonStringEnumConverter))] [JsonConverter(typeof(JsonStringEnumConverter))]
public SearchWindowScreens SearchWindowScreen { get; set; } = SearchWindowScreens.Cursor; public SearchWindowScreens SearchWindowScreen { get; set; } = SearchWindowScreens.Cursor;

View file

@ -99,10 +99,9 @@ namespace Flow.Launcher.Plugin
public bool HideActionKeywordPanel { get; set; } public bool HideActionKeywordPanel { get; set; }
/// <summary> /// <summary>
/// Plugin search delay time. Null means use default search delay time. /// Plugin search delay time in ms. Null means use default search delay time.
/// </summary> /// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))] public int? SearchDelayTime { get; set; } = null;
public SearchDelayTime? SearchDelayTime { get; set; } = null;
/// <summary> /// <summary>
/// Plugin icon path. /// Plugin icon path.

View file

@ -1,32 +0,0 @@
namespace Flow.Launcher.Plugin;
/// <summary>
/// Enum for search delay time
/// </summary>
public enum SearchDelayTime
{
/// <summary>
/// Very long search delay time. 250ms.
/// </summary>
VeryLong,
/// <summary>
/// Long search delay time. 200ms.
/// </summary>
Long,
/// <summary>
/// Normal search delay time. 150ms. Default value.
/// </summary>
Normal,
/// <summary>
/// Short search delay time. 100ms.
/// </summary>
Short,
/// <summary>
/// Very short search delay time. 50ms.
/// </summary>
VeryShort
}

View file

@ -380,9 +380,7 @@
<!-- Search Delay Settings Dialog --> <!-- Search Delay Settings Dialog -->
<system:String x:Key="searchDelayTimeTitle">Search Delay Time Setting</system:String> <system:String x:Key="searchDelayTimeTitle">Search Delay Time Setting</system:String>
<system:String x:Key="searchDelayTime_tips">Select the search delay time you like to use for the plugin. Select "{0}" if you don't want to specify any, and the plugin will use default search delay time.</system:String> <system:String x:Key="searchDelayTimeTips">Input the search delay time in ms you like to use for the plugin. Input empty if you don't want to specify any, and the plugin will use default search delay time.</system:String>
<system:String x:Key="currentSearchDelayTime">Current search delay time</system:String>
<system:String x:Key="newSearchDelayTime">New search delay time</system:String>
<!-- Custom Query Hotkey Dialog --> <!-- Custom Query Hotkey Dialog -->
<system:String x:Key="customeQueryHotkeyTitle">Custom Query Hotkey</system:String> <system:String x:Key="customeQueryHotkeyTitle">Custom Query Hotkey</system:String>

View file

@ -85,7 +85,12 @@
Foreground="{DynamicResource Color08B}" Foreground="{DynamicResource Color08B}"
Text="{DynamicResource searchDelay}" Text="{DynamicResource searchDelay}"
ToolTip="{DynamicResource searchDelayToolTip}" /> ToolTip="{DynamicResource searchDelayToolTip}" />
<cc:InstalledPluginSearchDelayCombobox Margin="0 0 8 0" /> <ui:NumberBox
Margin="0 0 8 0"
Maximum="1000"
Minimum="0"
SpinButtonPlacementMode="Inline"
ToolTip="{DynamicResource searchDelayToolTip}" />
</StackPanel> </StackPanel>
<!-- Put OnOffControl after PriorityControl & SearchDelayControl so that it can display correctly --> <!-- Put OnOffControl after PriorityControl & SearchDelayControl so that it can display correctly -->

View file

@ -1,49 +0,0 @@
<UserControl
x:Class="Flow.Launcher.Resources.Controls.InstalledPluginSearchDelay"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModel="clr-namespace:Flow.Launcher.ViewModel"
d:DataContext="{d:DesignInstance viewModel:PluginViewModel}"
d:DesignHeight="300"
d:DesignWidth="300"
mc:Ignorable="d">
<Border
Width="Auto"
Height="Auto"
Margin="0"
Padding="0"
BorderThickness="0 1 0 0"
CornerRadius="0"
Style="{DynamicResource SettingGroupBox}">
<DockPanel Margin="{StaticResource SettingPanelMargin}">
<TextBlock
Margin="{StaticResource SettingPanelItemRightMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
DockPanel.Dock="Left"
Style="{StaticResource Glyph}">
&#xE916;
</TextBlock>
<TextBlock
Margin="{StaticResource SettingPanelItemRightMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
DockPanel.Dock="Left"
Style="{DynamicResource SettingTitleLabel}"
Text="{DynamicResource pluginSearchDelayTime}" />
<!-- Here Margin="0 -4.5 0 -4.5" is to remove redundant top bottom margin from Margin="{StaticResource SettingPanelMargin}" -->
<Button
Width="100"
Margin="0 -4.5 0 -4.5"
HorizontalAlignment="Right"
Command="{Binding SetSearchDelayTimeCommand}"
Content="{Binding SearchDelayTimeText}"
Cursor="Hand"
DockPanel.Dock="Right"
FontWeight="Bold"
ToolTip="{DynamicResource pluginSearchDelayTimeTooltip}" />
</DockPanel>
</Border>
</UserControl>

View file

@ -1,11 +0,0 @@
using System.Windows.Controls;
namespace Flow.Launcher.Resources.Controls;
public partial class InstalledPluginSearchDelay : UserControl
{
public InstalledPluginSearchDelay()
{
InitializeComponent();
}
}

View file

@ -1,39 +0,0 @@
<UserControl
x:Class="Flow.Launcher.Resources.Controls.InstalledPluginSearchDelayCombobox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModel="clr-namespace:Flow.Launcher.ViewModel"
d:DataContext="{d:DesignInstance viewModel:PluginViewModel}"
d:DesignHeight="300"
d:DesignWidth="300"
mc:Ignorable="d">
<Border
Width="Auto"
Height="Auto"
Margin="0"
Padding="0"
BorderThickness="0"
CornerRadius="0">
<DockPanel>
<TextBlock Visibility="Collapsed"
Margin="0 0 8 0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="{DynamicResource pluginSearchDelayTime}"
FontSize="13"
Foreground="{DynamicResource Color08B}" />
<ComboBox
x:Name="cbDelay"
Width="100"
HorizontalAlignment="Right"
DisplayMemberPath="Display"
SelectedValuePath="Value"
SelectionChanged="CbDelay_SelectionChanged"
DockPanel.Dock="Right"
ToolTip="{DynamicResource pluginSearchDelayTimeTooltip}" />
</DockPanel>
</Border>
</UserControl>

View file

@ -1,84 +0,0 @@
using System.Collections.Generic;
using System.Windows.Controls;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.Resources.Controls
{
public partial class InstalledPluginSearchDelayCombobox
{
public InstalledPluginSearchDelayCombobox()
{
InitializeComponent();
LoadDelayOptions();
Loaded += InstalledPluginSearchDelayCombobox_Loaded;
}
private void InstalledPluginSearchDelayCombobox_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
if (DataContext is ViewModel.PluginViewModel viewModel)
{
// 초기 값 설정
int currentDelayMs = GetCurrentDelayMs(viewModel);
foreach (DelayOption option in cbDelay.Items)
{
if (option.Value == currentDelayMs)
{
cbDelay.SelectedItem = option;
break;
}
}
}
}
private int GetCurrentDelayMs(ViewModel.PluginViewModel viewModel)
{
// SearchDelayTime enum 값을 int로 변환
SearchDelayTime? delayTime = viewModel.PluginPair.Metadata.SearchDelayTime;
if (delayTime.HasValue)
{
return (int)delayTime.Value;
}
return 0; // 기본값
}
private void LoadDelayOptions()
{
// 검색 지연 시간 옵션들 (SearchDelayTime enum 값에 맞춰야 함)
var delayOptions = new List<DelayOption>
{
new DelayOption { Display = "0 ms", Value = 0 },
new DelayOption { Display = "50 ms", Value = 50 },
new DelayOption { Display = "100 ms", Value = 100 },
new DelayOption { Display = "150 ms", Value = 150 },
new DelayOption { Display = "200 ms", Value = 200 },
new DelayOption { Display = "250 ms", Value = 250 },
new DelayOption { Display = "300 ms", Value = 300 },
new DelayOption { Display = "350 ms", Value = 350 },
new DelayOption { Display = "400 ms", Value = 400 },
new DelayOption { Display = "450 ms", Value = 450 },
new DelayOption { Display = "500 ms", Value = 500 },
};
cbDelay.ItemsSource = delayOptions;
}
private void CbDelay_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (DataContext is ViewModel.PluginViewModel viewModel && cbDelay.SelectedItem is DelayOption selectedOption)
{
// int 값을 SearchDelayTime enum으로 변환
int delayValue = selectedOption.Value;
viewModel.PluginPair.Metadata.SearchDelayTime = (SearchDelayTime)delayValue;
// 설정 저장
//How to save?
}
}
}
public class DelayOption
{
public string Display { get; set; }
public int Value { get; set; }
}
}

View file

@ -1,138 +0,0 @@
<Window
x:Class="Flow.Launcher.SearchDelayTimeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{DynamicResource searchDelayTimeTitle}"
Width="450"
Background="{DynamicResource PopuBGColor}"
Foreground="{DynamicResource PopupTextColor}"
Icon="Images\app.png"
Loaded="SearchDelayTimeWindow_OnLoaded"
ResizeMode="NoResize"
SizeToContent="Height"
WindowStartupLocation="CenterScreen">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<Grid>
<StackPanel Grid.Row="0">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="4"
Click="BtnCancel_OnClick"
Style="{StaticResource TitleBarCloseButtonStyle}">
<Path
Width="46"
Height="32"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1">
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
<Setter Property="Opacity" Value="0.5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Button>
</Grid>
</StackPanel>
<StackPanel Margin="26 12 26 0">
<StackPanel Grid.Row="0" Margin="0 0 0 12">
<TextBlock
Grid.Column="0"
Margin="0 0 0 0"
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource searchDelayTimeTitle}"
TextAlignment="Left" />
</StackPanel>
<StackPanel>
<TextBlock
x:Name="tbSearchDelayTimeTips"
FontSize="14"
TextAlignment="Left"
TextWrapping="WrapWithOverflow" />
</StackPanel>
<StackPanel Margin="0 18 0 0" Orientation="Horizontal">
<TextBlock
Grid.Row="0"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource currentSearchDelayTime}" />
<TextBlock
x:Name="tbOldSearchDelayTime"
Grid.Row="0"
Grid.Column="1"
Margin="14 10 10 10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
FontWeight="SemiBold"
Foreground="{DynamicResource Color05B}" />
</StackPanel>
<StackPanel Margin="0 0 0 10" Orientation="Horizontal">
<TextBlock
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource newSearchDelayTime}" />
<ComboBox
x:Name="cbDelay"
MaxWidth="200"
Margin="10 10 15 10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
DisplayMemberPath="Display"
SelectedValuePath="Value" />
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
<Border
Grid.Row="1"
Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0 1 0 0">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button
x:Name="btnCancel"
Width="145"
Height="30"
Margin="10 0 5 0"
Click="BtnCancel_OnClick"
Content="{DynamicResource cancel}" />
<Button
x:Name="btnDone"
Width="145"
Height="30"
Margin="5 0 10 0"
Click="btnDone_OnClick"
Style="{StaticResource AccentButtonStyle}">
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
</Button>
</StackPanel>
</Border>
</Grid>
</Window>

View file

@ -1,57 +0,0 @@
using System.Linq;
using System.Windows;
using Flow.Launcher.Plugin;
using Flow.Launcher.SettingPages.ViewModels;
using Flow.Launcher.ViewModel;
using static Flow.Launcher.SettingPages.ViewModels.SettingsPaneGeneralViewModel;
namespace Flow.Launcher;
public partial class SearchDelayTimeWindow : Window
{
private readonly PluginViewModel _pluginViewModel;
public SearchDelayTimeWindow(PluginViewModel pluginViewModel)
{
InitializeComponent();
_pluginViewModel = pluginViewModel;
}
private void SearchDelayTimeWindow_OnLoaded(object sender, RoutedEventArgs e)
{
tbSearchDelayTimeTips.Text = string.Format(App.API.GetTranslation("searchDelayTime_tips"),
App.API.GetTranslation("default"));
tbOldSearchDelayTime.Text = _pluginViewModel.SearchDelayTimeText;
var searchDelayTimes = DropdownDataGeneric<SearchDelayTime>.GetValues<SearchDelayTimeData>("SearchDelayTime");
SearchDelayTimeData selected = null;
// Because default value is SearchDelayTime.VeryShort, we need to get selected value before adding default value
if (_pluginViewModel.PluginSearchDelayTime != null)
{
selected = searchDelayTimes.FirstOrDefault(x => x.Value == _pluginViewModel.PluginSearchDelayTime);
}
// Add default value to the beginning of the list
// When _pluginViewModel.PluginSearchDelayTime equals null, we will select this
searchDelayTimes.Insert(0, new SearchDelayTimeData { Display = App.API.GetTranslation("default"), LocalizationKey = "default" });
selected ??= searchDelayTimes.FirstOrDefault();
cbDelay.ItemsSource = searchDelayTimes;
cbDelay.SelectedItem = selected;
cbDelay.Focus();
}
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
{
Close();
}
private void btnDone_OnClick(object sender, RoutedEventArgs _)
{
// Update search delay time
var selected = cbDelay.SelectedItem as SearchDelayTimeData;
SearchDelayTime? changedValue = selected?.LocalizationKey != "default" ? selected.Value : null;
_pluginViewModel.PluginSearchDelayTime = changedValue;
// Update search delay time text and close window
_pluginViewModel.OnSearchDelayTimeChanged();
Close();
}
}

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using Flow.Launcher.Core; using Flow.Launcher.Core;
using Flow.Launcher.Core.Configuration; using Flow.Launcher.Core.Configuration;
@ -31,7 +32,25 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
public class SearchWindowAlignData : DropdownDataGeneric<SearchWindowAligns> { } public class SearchWindowAlignData : DropdownDataGeneric<SearchWindowAligns> { }
public class SearchPrecisionData : DropdownDataGeneric<SearchPrecisionScore> { } public class SearchPrecisionData : DropdownDataGeneric<SearchPrecisionScore> { }
public class LastQueryModeData : DropdownDataGeneric<LastQueryMode> { } public class LastQueryModeData : DropdownDataGeneric<LastQueryMode> { }
public class SearchDelayTimeData : DropdownDataGeneric<SearchDelayTime> { } public class SearchDelayTimeData
{
public string Display { get; set; }
public int Value { get; set; }
public static List<SearchDelayTimeData> GetValues()
{
var settings = Ioc.Default.GetRequiredService<Settings>();
var data = new List<SearchDelayTimeData>();
foreach (var value in settings.SearchDelayTimeRange)
{
var display = $"{value}ms";
data.Add(new SearchDelayTimeData { Display = display, Value = value });
}
return data;
}
}
public bool StartFlowLauncherOnSystemStartup public bool StartFlowLauncherOnSystemStartup
{ {
@ -144,19 +163,15 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
public List<LastQueryModeData> LastQueryModes { get; } = public List<LastQueryModeData> LastQueryModes { get; } =
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery"); DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");
public List<SearchDelayTimeData> SearchDelayTimes { get; } = public List<SearchDelayTimeData> SearchDelayTimes { get; } = SearchDelayTimeData.GetValues();
DropdownDataGeneric<SearchDelayTime>.GetValues<SearchDelayTimeData>("SearchDelayTime");
public SearchDelayTimeData SearchDelayTime public SearchDelayTimeData SearchDelayTime
{ {
get => SearchDelayTimes.FirstOrDefault(x => x.Value == Settings.SearchDelayTime) ?? get => SearchDelayTimes.FirstOrDefault(x => x.Value == Settings.SearchDelayTime);
SearchDelayTimes.FirstOrDefault(x => x.Value == Plugin.SearchDelayTime.Normal) ??
SearchDelayTimes.FirstOrDefault();
set set
{ {
if (value == null) if (value == null) return;
return;
if (Settings.SearchDelayTime != value.Value) if (Settings.SearchDelayTime != value.Value)
{ {
Settings.SearchDelayTime = value.Value; Settings.SearchDelayTime = value.Value;
@ -170,7 +185,6 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
DropdownDataGeneric<SearchWindowAligns>.UpdateLabels(SearchWindowAligns); DropdownDataGeneric<SearchWindowAligns>.UpdateLabels(SearchWindowAligns);
DropdownDataGeneric<SearchPrecisionScore>.UpdateLabels(SearchPrecisionScores); DropdownDataGeneric<SearchPrecisionScore>.UpdateLabels(SearchPrecisionScores);
DropdownDataGeneric<LastQueryMode>.UpdateLabels(LastQueryModes); DropdownDataGeneric<LastQueryMode>.UpdateLabels(LastQueryModes);
DropdownDataGeneric<SearchDelayTime>.UpdateLabels(SearchDelayTimes);
} }
public string Language public string Language

View file

@ -196,18 +196,21 @@
</cc:Card> </cc:Card>
</cc:CardGroup> </cc:CardGroup>
<cc:ExCard Margin="0 14 0 0" Title="{DynamicResource searchDelay}" <cc:ExCard
Icon="&#xE961;" Title="{DynamicResource searchDelay}"
Sub="{DynamicResource searchDelayToolTip}"> Margin="0 14 0 0"
Icon="&#xE961;"
Sub="{DynamicResource searchDelayToolTip}">
<cc:ExCard.SideContent> <cc:ExCard.SideContent>
<ui:ToggleSwitch <ui:ToggleSwitch
IsOn="{Binding Settings.SearchQueryResultsWithDelay}" IsOn="{Binding Settings.SearchQueryResultsWithDelay}"
OffContent="{DynamicResource disable}" OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" /> OnContent="{DynamicResource enable}" />
</cc:ExCard.SideContent> </cc:ExCard.SideContent>
<cc:Card Type="InsideFit" <cc:Card
Title="{DynamicResource searchDelayTime}" Title="{DynamicResource searchDelayTime}"
Sub="{DynamicResource searchDelayTimeToolTip}"> Sub="{DynamicResource searchDelayTimeToolTip}"
Type="InsideFit">
<ComboBox <ComboBox
MaxWidth="200" MaxWidth="200"
DisplayMemberPath="Display" DisplayMemberPath="Display"
@ -216,7 +219,7 @@
SelectedValuePath="Value" /> SelectedValuePath="Value" />
</cc:Card> </cc:Card>
</cc:ExCard> </cc:ExCard>
<cc:Card <cc:Card
Title="{DynamicResource defaultFileManager}" Title="{DynamicResource defaultFileManager}"
Margin="0 14 0 0" Margin="0 14 0 0"

View file

@ -1257,15 +1257,7 @@ namespace Flow.Launcher.ViewModel
{ {
if (searchDelay) if (searchDelay)
{ {
var searchDelayTime = (plugin.Metadata.SearchDelayTime ?? Settings.SearchDelayTime) switch var searchDelayTime = plugin.Metadata.SearchDelayTime ?? Settings.SearchDelayTime;
{
SearchDelayTime.VeryLong => 250,
SearchDelayTime.Long => 200,
SearchDelayTime.Normal => 150,
SearchDelayTime.Short => 100,
SearchDelayTime.VeryShort => 50,
_ => 150
};
await Task.Delay(searchDelayTime, token); await Task.Delay(searchDelayTime, token);

View file

@ -95,7 +95,7 @@ namespace Flow.Launcher.ViewModel
} }
} }
public SearchDelayTime? PluginSearchDelayTime public int? PluginSearchDelayTime
{ {
get => PluginPair.Metadata.SearchDelayTime; get => PluginPair.Metadata.SearchDelayTime;
set set
@ -192,12 +192,5 @@ namespace Flow.Launcher.ViewModel
var changeKeywordsWindow = new ActionKeywords(this); var changeKeywordsWindow = new ActionKeywords(this);
changeKeywordsWindow.ShowDialog(); changeKeywordsWindow.ShowDialog();
} }
[RelayCommand]
private void SetSearchDelayTime()
{
var searchDelayTimeWindow = new SearchDelayTimeWindow(this);
searchDelayTimeWindow.ShowDialog();
}
} }
} }

View file

@ -32,5 +32,5 @@
"Website": "https://github.com/Flow-Launcher/Flow.Launcher", "Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll", "ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll",
"IcoPath": "Images\\web_search.png", "IcoPath": "Images\\web_search.png",
"SearchDelayTime": "VeryLong" "SearchDelayTime": 450
} }