Skip to content

Commit c137091

Browse files
authored
Merge pull request #3248 from Jack251970/custom_hotkey_preview
Fix Custom Query Hotkey / Shortcuts Preview Issue
2 parents 8ae53a2 + 6b032b3 commit c137091

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

Flow.Launcher/CustomQueryHotkeySetting.xaml.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ namespace Flow.Launcher
1313
public partial class CustomQueryHotkeySetting : Window
1414
{
1515
private SettingWindow _settingWidow;
16+
private readonly Settings _settings;
1617
private bool update;
1718
private CustomPluginHotkey updateCustomHotkey;
18-
public Settings Settings { get; }
1919

2020
public CustomQueryHotkeySetting(SettingWindow settingWidow, Settings settings)
2121
{
2222
_settingWidow = settingWidow;
23-
Settings = settings;
23+
_settings = settings;
2424
InitializeComponent();
2525
}
2626

@@ -33,13 +33,13 @@ private void btnAdd_OnClick(object sender, RoutedEventArgs e)
3333
{
3434
if (!update)
3535
{
36-
Settings.CustomPluginHotkeys ??= new ObservableCollection<CustomPluginHotkey>();
36+
_settings.CustomPluginHotkeys ??= new ObservableCollection<CustomPluginHotkey>();
3737

3838
var pluginHotkey = new CustomPluginHotkey
3939
{
4040
Hotkey = HotkeyControl.CurrentHotkey.ToString(), ActionKeyword = tbAction.Text
4141
};
42-
Settings.CustomPluginHotkeys.Add(pluginHotkey);
42+
_settings.CustomPluginHotkeys.Add(pluginHotkey);
4343

4444
HotKeyMapper.SetCustomQueryHotkey(pluginHotkey);
4545
}
@@ -59,7 +59,7 @@ private void btnAdd_OnClick(object sender, RoutedEventArgs e)
5959

6060
public void UpdateItem(CustomPluginHotkey item)
6161
{
62-
updateCustomHotkey = Settings.CustomPluginHotkeys.FirstOrDefault(o =>
62+
updateCustomHotkey = _settings.CustomPluginHotkeys.FirstOrDefault(o =>
6363
o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey);
6464
if (updateCustomHotkey == null)
6565
{
@@ -77,8 +77,7 @@ public void UpdateItem(CustomPluginHotkey item)
7777
private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e)
7878
{
7979
App.API.ChangeQuery(tbAction.Text);
80-
Application.Current.MainWindow.Show();
81-
Application.Current.MainWindow.Opacity = 1;
80+
App.API.ShowMainWindow();
8281
Application.Current.MainWindow.Focus();
8382
}
8483

Flow.Launcher/CustomShortcutSetting.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ private void cmdEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
6565
private void BtnTestShortcut_OnClick(object sender, RoutedEventArgs e)
6666
{
6767
App.API.ChangeQuery(tbExpand.Text);
68-
Application.Current.MainWindow.Show();
69-
Application.Current.MainWindow.Opacity = 1;
68+
App.API.ShowMainWindow();
7069
Application.Current.MainWindow.Focus();
7170
}
7271
}

0 commit comments

Comments
 (0)