Improve code quality

This commit is contained in:
Jack251970 2025-04-07 11:23:50 +08:00
parent 81715f12ea
commit bf63ddad25
3 changed files with 56 additions and 50 deletions

View file

@ -1,16 +1,21 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows;
using CommunityToolkit.Mvvm.Input;
using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.ViewModel;
using ModernWpf.Controls;
#nullable enable
namespace Flow.Launcher.SettingPages.ViewModels;
public class SettingsPanePluginsViewModel : BaseModel
public partial class SettingsPanePluginsViewModel : BaseModel
{
private readonly Settings _settings;
@ -147,4 +152,48 @@ public class SettingsPanePluginsViewModel : BaseModel
StringMatcher.FuzzySearch(FilterText, v.PluginPair.Metadata.Description).IsSearchPrecisionScoreMet()
)
.ToList();
[RelayCommand]
private async Task OpenHelperAsync()
{
var helpDialog = new ContentDialog()
{
Content = new StackPanel
{
Children =
{
new TextBlock
{
Text = (string)Application.Current.Resources["changePriorityWindow"],
FontSize = 18,
Margin = new Thickness(0, 0, 0, 10),
TextWrapping = TextWrapping.Wrap
},
new TextBlock
{
Text = (string)Application.Current.Resources["priority_tips"],
TextWrapping = TextWrapping.Wrap
},
new TextBlock
{
Text = (string)Application.Current.Resources["searchDelayTimeTitle"],
FontSize = 18,
Margin = new Thickness(0, 24, 0, 10),
TextWrapping = TextWrapping.Wrap
},
new TextBlock
{
Text = (string)Application.Current.Resources["searchDelayTime_tips"],
TextWrapping = TextWrapping.Wrap
}
}
},
PrimaryButtonText = (string)Application.Current.Resources["commonOK"],
CornerRadius = new CornerRadius(8),
Style = (Style)Application.Current.Resources["ContentDialog"]
};
await helpDialog.ShowAsync();
}
}

View file

@ -47,10 +47,11 @@
<ComboBox
x:Name="DisplayModeComboBox"
Width="Auto"
Height="34"
MinWidth="150"
MaxWidth="150"
Height="34" HorizontalContentAlignment="Left"
Margin="0 0 4 0"
HorizontalContentAlignment="Left"
Background="{DynamicResource Color00B}"
SelectedValue="{Binding SelectedDisplayMode, Mode=TwoWay}"
SelectedValuePath="Tag"
@ -67,10 +68,12 @@
</ComboBox>
<Button
Width="34"
Height="34" FontFamily="{DynamicResource SymbolThemeFontFamily}"
Height="34"
Margin="0 0 20 0"
Command="{Binding OpenHelperCommand}"
Content="&#xe9ce;"
FontSize="14" Click="Help_Click"/>
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontSize="14" />
<TextBox
Name="PluginFilterTextbox"
Width="150"

View file

@ -5,8 +5,6 @@ using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.SettingPages.ViewModels;
using Flow.Launcher.Infrastructure.UserSettings;
using System.Windows.Controls;
using System.Windows.Media;
using ModernWpf.Controls;
namespace Flow.Launcher.SettingPages.Views;
@ -39,48 +37,4 @@ public partial class SettingsPanePlugins
if (e.Key is not Key.F || Keyboard.Modifiers is not ModifierKeys.Control) return;
PluginFilterTextbox.Focus();
}
private async void Help_Click(object sender, RoutedEventArgs e)
{
var helpDialog = new ContentDialog()
{
Content = new StackPanel
{
Children =
{
new TextBlock
{
Text = (string)Application.Current.Resources["changePriorityWindow"],
FontSize = 18,
Margin = new Thickness(0, 0, 0, 10),
TextWrapping = TextWrapping.Wrap
},
new TextBlock
{
Text = (string)Application.Current.Resources["priority_tips"],
TextWrapping = TextWrapping.Wrap
},
new TextBlock
{
Text = (string)Application.Current.Resources["searchDelayTimeTitle"],
FontSize = 18,
Margin = new Thickness(0, 24, 0, 10),
TextWrapping = TextWrapping.Wrap
},
new TextBlock
{
Text = (string)Application.Current.Resources["searchDelayTime_tips"],
TextWrapping = TextWrapping.Wrap
}
}
},
PrimaryButtonText = (string)Application.Current.Resources["commonOK"],
CornerRadius = new CornerRadius(8),
Style = (Style)Application.Current.Resources["ContentDialog"]
};
await helpDialog.ShowAsync();
}
}