|
1 | 1 | using System.Windows;
|
2 | 2 |
|
3 |
| -namespace Flow.Launcher.Plugin.Sys |
| 3 | +namespace Flow.Launcher.Plugin.Sys; |
| 4 | + |
| 5 | +public partial class CommandKeywordSettingWindow |
4 | 6 | {
|
5 |
| - public partial class CommandKeywordSettingWindow |
| 7 | + private readonly Command _oldSearchSource; |
| 8 | + |
| 9 | + public CommandKeywordSettingWindow(Command old) |
6 | 10 | {
|
7 |
| - private readonly Command _oldSearchSource; |
8 |
| - private readonly PluginInitContext _context; |
| 11 | + _oldSearchSource = old; |
| 12 | + InitializeComponent(); |
| 13 | + CommandKeyword.Text = old.Keyword; |
| 14 | + CommandKeywordTips.Text = string.Format(Main.Context.API.GetTranslation("flowlauncher_plugin_sys_custom_command_keyword_tip"), old.Name); |
| 15 | + } |
9 | 16 |
|
10 |
| - public CommandKeywordSettingWindow(PluginInitContext context, Command old) |
11 |
| - { |
12 |
| - _context = context; |
13 |
| - _oldSearchSource = old; |
14 |
| - InitializeComponent(); |
15 |
| - CommandKeyword.Text = old.Keyword; |
16 |
| - CommandKeywordTips.Text = string.Format(_context.API.GetTranslation("flowlauncher_plugin_sys_custom_command_keyword_tip"), old.Name); |
17 |
| - } |
| 17 | + private void OnCancelButtonClick(object sender, RoutedEventArgs e) |
| 18 | + { |
| 19 | + Close(); |
| 20 | + } |
18 | 21 |
|
19 |
| - private void OnCancelButtonClick(object sender, RoutedEventArgs e) |
| 22 | + private void OnConfirmButtonClick(object sender, RoutedEventArgs e) |
| 23 | + { |
| 24 | + var keyword = CommandKeyword.Text; |
| 25 | + if (string.IsNullOrEmpty(keyword)) |
20 | 26 | {
|
21 |
| - Close(); |
| 27 | + var warning = Main.Context.API.GetTranslation("flowlauncher_plugin_sys_input_command_keyword"); |
| 28 | + Main.Context.API.ShowMsgBox(warning); |
22 | 29 | }
|
23 |
| - |
24 |
| - private void OnConfirmButtonClick(object sender, RoutedEventArgs e) |
| 30 | + else |
25 | 31 | {
|
26 |
| - var keyword = CommandKeyword.Text; |
27 |
| - if (string.IsNullOrEmpty(keyword)) |
28 |
| - { |
29 |
| - var warning = _context.API.GetTranslation("flowlauncher_plugin_sys_input_command_keyword"); |
30 |
| - _context.API.ShowMsgBox(warning); |
31 |
| - } |
32 |
| - else |
33 |
| - { |
34 |
| - _oldSearchSource.Keyword = keyword; |
35 |
| - Close(); |
36 |
| - } |
| 32 | + _oldSearchSource.Keyword = keyword; |
| 33 | + Close(); |
37 | 34 | }
|
| 35 | + } |
38 | 36 |
|
39 |
| - private void OnResetButtonClick(object sender, RoutedEventArgs e) |
40 |
| - { |
41 |
| - // Key is the default value of this command |
42 |
| - CommandKeyword.Text = _oldSearchSource.Key; |
43 |
| - } |
| 37 | + private void OnResetButtonClick(object sender, RoutedEventArgs e) |
| 38 | + { |
| 39 | + // Key is the default value of this command |
| 40 | + CommandKeyword.Text = _oldSearchSource.Key; |
44 | 41 | }
|
45 | 42 | }
|
0 commit comments