From ee0f8ef22a8563c3b53f697fb1b0f7cf02cc6ae3 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Sat, 11 Dec 2021 11:52:43 -0600 Subject: [PATCH 01/23] Implement PluginSearch TextBox & ContentControl Lazy Load --- Flow.Launcher/SettingWindow.xaml | 16 ++++++++-- Flow.Launcher/SettingWindow.xaml.cs | 32 +++++++++++++++++-- Flow.Launcher/ViewModel/PluginViewModel.cs | 13 +++++++- .../ViewModel/SettingWindowViewModel.cs | 1 + 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index d8c94390ba7..7d144e3a1b0 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -901,6 +901,7 @@ + @@ -912,12 +913,23 @@ Text="{DynamicResource plugin}" TextAlignment="left" /> + + + ThemeManager.Current.ApplicationTheme = settings.ColorScheme switch { Constant.Light => ApplicationTheme.Light, @@ -370,5 +379,22 @@ private void Window_StateChanged(object sender, EventArgs e) RefreshMaximizeRestoreButton(); } + private CollectionView pluginListView; + + private bool PluginFilter(object item) + { + if (string.IsNullOrEmpty(pluginFilterTxb.Text)) + return true; + if (item is PluginViewModel model) + { + return StringMatcher.FuzzySearch(pluginFilterTxb.Text, model.PluginPair.Metadata.Name).IsSearchPrecisionScoreMet(); + } + return false; + } + + private void OnPluginSearchTextChanged(object sender, TextChangedEventArgs e) + { + pluginListView.Refresh(); + } } -} +} \ No newline at end of file diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 209198822e0..864a606463d 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -30,9 +30,20 @@ public bool PluginState get => !PluginPair.Metadata.Disabled; set => PluginPair.Metadata.Disabled = !value; } + public bool IsExpanded + { + get => _isExpanded; + set + { + _isExpanded = value; + OnPropertyChanged(); + OnPropertyChanged(nameof(SettingControl)); + } + } private Control _settingControl; - public Control SettingControl => _settingControl ??= PluginPair.Plugin is not ISettingProvider settingProvider ? new Control() : settingProvider.CreateSettingPanel(); + private bool _isExpanded; + public Control SettingControl => IsExpanded ? _settingControl ??= PluginPair.Plugin is not ISettingProvider settingProvider ? new Control() : settingProvider.CreateSettingPanel() : null; public Visibility ActionKeywordsVisibility => PluginPair.Metadata.ActionKeywords.Count == 1 ? Visibility.Visible : Visibility.Collapsed; public string InitilizaTime => PluginPair.Metadata.InitTime + "ms"; diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 342c85da202..7c9caf13c6e 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -19,6 +19,7 @@ using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedModels; +using System.Windows.Data; namespace Flow.Launcher.ViewModel { From 2b134c8b9ab304bac7c0f1ed0be1649729ea3659 Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 12 Dec 2021 06:49:15 +0900 Subject: [PATCH 02/23] Adjust Design & Add Searchbox in plugin store --- Flow.Launcher/SettingWindow.xaml | 66 +++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 7d144e3a1b0..b130fbfcab7 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -901,30 +901,38 @@ - - - - - - + + + + + + + @@ -1296,19 +1304,31 @@ Text="{DynamicResource pluginStore}" TextAlignment="left" /> - + Margin="5,18,0,0">