Skip to content

Commit bf63dda

Browse files
committed
Improve code quality
1 parent 81715f1 commit bf63dda

File tree

3 files changed

+56
-50
lines changed

3 files changed

+56
-50
lines changed

Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
using System.Collections.Generic;
22
using System.Linq;
3+
using System.Threading.Tasks;
4+
using System.Windows.Controls;
5+
using System.Windows;
6+
using CommunityToolkit.Mvvm.Input;
37
using Flow.Launcher.Core.Plugin;
48
using Flow.Launcher.Infrastructure;
59
using Flow.Launcher.Infrastructure.UserSettings;
610
using Flow.Launcher.Plugin;
711
using Flow.Launcher.ViewModel;
12+
using ModernWpf.Controls;
813

914
#nullable enable
1015

1116
namespace Flow.Launcher.SettingPages.ViewModels;
1217

13-
public class SettingsPanePluginsViewModel : BaseModel
18+
public partial class SettingsPanePluginsViewModel : BaseModel
1419
{
1520
private readonly Settings _settings;
1621

@@ -147,4 +152,48 @@ public SettingsPanePluginsViewModel(Settings settings)
147152
StringMatcher.FuzzySearch(FilterText, v.PluginPair.Metadata.Description).IsSearchPrecisionScoreMet()
148153
)
149154
.ToList();
155+
156+
[RelayCommand]
157+
private async Task OpenHelperAsync()
158+
{
159+
var helpDialog = new ContentDialog()
160+
{
161+
Content = new StackPanel
162+
{
163+
Children =
164+
{
165+
new TextBlock
166+
{
167+
Text = (string)Application.Current.Resources["changePriorityWindow"],
168+
FontSize = 18,
169+
Margin = new Thickness(0, 0, 0, 10),
170+
TextWrapping = TextWrapping.Wrap
171+
},
172+
new TextBlock
173+
{
174+
Text = (string)Application.Current.Resources["priority_tips"],
175+
TextWrapping = TextWrapping.Wrap
176+
},
177+
new TextBlock
178+
{
179+
Text = (string)Application.Current.Resources["searchDelayTimeTitle"],
180+
FontSize = 18,
181+
Margin = new Thickness(0, 24, 0, 10),
182+
TextWrapping = TextWrapping.Wrap
183+
},
184+
new TextBlock
185+
{
186+
Text = (string)Application.Current.Resources["searchDelayTime_tips"],
187+
TextWrapping = TextWrapping.Wrap
188+
}
189+
}
190+
},
191+
192+
PrimaryButtonText = (string)Application.Current.Resources["commonOK"],
193+
CornerRadius = new CornerRadius(8),
194+
Style = (Style)Application.Current.Resources["ContentDialog"]
195+
};
196+
197+
await helpDialog.ShowAsync();
198+
}
150199
}

Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@
4747
<ComboBox
4848
x:Name="DisplayModeComboBox"
4949
Width="Auto"
50+
Height="34"
5051
MinWidth="150"
5152
MaxWidth="150"
52-
Height="34" HorizontalContentAlignment="Left"
5353
Margin="0 0 4 0"
54+
HorizontalContentAlignment="Left"
5455
Background="{DynamicResource Color00B}"
5556
SelectedValue="{Binding SelectedDisplayMode, Mode=TwoWay}"
5657
SelectedValuePath="Tag"
@@ -67,10 +68,12 @@
6768
</ComboBox>
6869
<Button
6970
Width="34"
70-
Height="34" FontFamily="{DynamicResource SymbolThemeFontFamily}"
71+
Height="34"
7172
Margin="0 0 20 0"
73+
Command="{Binding OpenHelperCommand}"
7274
Content="&#xe9ce;"
73-
FontSize="14" Click="Help_Click"/>
75+
FontFamily="{DynamicResource SymbolThemeFontFamily}"
76+
FontSize="14" />
7477
<TextBox
7578
Name="PluginFilterTextbox"
7679
Width="150"

Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using Flow.Launcher.SettingPages.ViewModels;
66
using Flow.Launcher.Infrastructure.UserSettings;
77
using System.Windows.Controls;
8-
using System.Windows.Media;
9-
using ModernWpf.Controls;
108

119
namespace Flow.Launcher.SettingPages.Views;
1210

@@ -39,48 +37,4 @@ private void SettingsPanePlugins_OnKeyDown(object sender, KeyEventArgs e)
3937
if (e.Key is not Key.F || Keyboard.Modifiers is not ModifierKeys.Control) return;
4038
PluginFilterTextbox.Focus();
4139
}
42-
43-
44-
private async void Help_Click(object sender, RoutedEventArgs e)
45-
{
46-
var helpDialog = new ContentDialog()
47-
{
48-
Content = new StackPanel
49-
{
50-
Children =
51-
{
52-
new TextBlock
53-
{
54-
Text = (string)Application.Current.Resources["changePriorityWindow"],
55-
FontSize = 18,
56-
Margin = new Thickness(0, 0, 0, 10),
57-
TextWrapping = TextWrapping.Wrap
58-
},
59-
new TextBlock
60-
{
61-
Text = (string)Application.Current.Resources["priority_tips"],
62-
TextWrapping = TextWrapping.Wrap
63-
},
64-
new TextBlock
65-
{
66-
Text = (string)Application.Current.Resources["searchDelayTimeTitle"],
67-
FontSize = 18,
68-
Margin = new Thickness(0, 24, 0, 10),
69-
TextWrapping = TextWrapping.Wrap
70-
},
71-
new TextBlock
72-
{
73-
Text = (string)Application.Current.Resources["searchDelayTime_tips"],
74-
TextWrapping = TextWrapping.Wrap
75-
}
76-
}
77-
},
78-
79-
PrimaryButtonText = (string)Application.Current.Resources["commonOK"],
80-
CornerRadius = new CornerRadius(8),
81-
Style = (Style)Application.Current.Resources["ContentDialog"]
82-
};
83-
84-
await helpDialog.ShowAsync();
85-
}
8640
}

0 commit comments

Comments
 (0)