mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
- Remove duplicate method.
This commit is contained in:
parent
5aa86f3f43
commit
e225c2bb7f
3 changed files with 8 additions and 48 deletions
|
|
@ -21,7 +21,7 @@ namespace Flow.Launcher.Helper
|
|||
mainViewModel = mainVM;
|
||||
settings = mainViewModel._settings;
|
||||
|
||||
SetHotkey(settings.Hotkey, OnHotkey);
|
||||
SetHotkey(settings.Hotkey, mainViewModel.OnHotkey);
|
||||
LoadCustomPluginHotkey();
|
||||
}
|
||||
|
||||
|
|
@ -55,46 +55,6 @@ namespace Flow.Launcher.Helper
|
|||
}
|
||||
}
|
||||
|
||||
internal static void OnHotkey(object sender, HotkeyEventArgs e)
|
||||
{
|
||||
if (!ShouldIgnoreHotkeys())
|
||||
{
|
||||
UpdateLastQUeryMode();
|
||||
var overlayTask = Task.Delay(50).ContinueWith(_ => {
|
||||
mainViewModel.ToggleFlowLauncher();
|
||||
});
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Checks if Flow Launcher should ignore any hotkeys
|
||||
/// </summary>
|
||||
private static bool ShouldIgnoreHotkeys()
|
||||
{
|
||||
return settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen();
|
||||
}
|
||||
|
||||
private static void UpdateLastQUeryMode()
|
||||
{
|
||||
switch(settings.LastQueryMode)
|
||||
{
|
||||
case LastQueryMode.Empty:
|
||||
mainViewModel.ChangeQueryText(string.Empty);
|
||||
break;
|
||||
case LastQueryMode.Preserved:
|
||||
mainViewModel.LastQuerySelected = true;
|
||||
break;
|
||||
case LastQueryMode.Selected:
|
||||
mainViewModel.LastQuerySelected = false;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException($"wrong LastQueryMode: <{settings.LastQueryMode}>");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
internal static void LoadCustomPluginHotkey()
|
||||
{
|
||||
if (settings.CustomPluginHotkeys == null)
|
||||
|
|
@ -110,7 +70,7 @@ namespace Flow.Launcher.Helper
|
|||
{
|
||||
SetHotkey(hotkey.Hotkey, (s, e) =>
|
||||
{
|
||||
if (ShouldIgnoreHotkeys())
|
||||
if (mainViewModel.ShouldIgnoreHotkeys())
|
||||
return;
|
||||
|
||||
mainViewModel.MainWindowVisibility = Visibility.Visible;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ namespace Flow.Launcher
|
|||
public readonly IPublicAPI API;
|
||||
private Settings settings;
|
||||
private SettingWindowViewModel viewModel;
|
||||
private static MainViewModel mainViewModel;
|
||||
|
||||
public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel)
|
||||
{
|
||||
|
|
@ -126,7 +127,7 @@ namespace Flow.Launcher
|
|||
if (HotkeyControl.CurrentHotkeyAvailable)
|
||||
{
|
||||
|
||||
HotKeyMapper.SetHotkey(HotkeyControl.CurrentHotkey, HotKeyMapper.OnHotkey);
|
||||
HotKeyMapper.SetHotkey(HotkeyControl.CurrentHotkey, mainViewModel.OnHotkey);
|
||||
HotKeyMapper.RemoveHotkey(settings.Hotkey);
|
||||
settings.Hotkey = HotkeyControl.CurrentHotkey.ToString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ using Microsoft.VisualStudio.Threading;
|
|||
using System.Threading.Channels;
|
||||
using ISavable = Flow.Launcher.Plugin.ISavable;
|
||||
using System.Windows.Threading;
|
||||
using NHotkey;
|
||||
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -225,7 +227,6 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
if (hideWindow)
|
||||
{
|
||||
//MainWindowVisibility = Visibility.Collapsed;
|
||||
Hide();
|
||||
}
|
||||
|
||||
|
|
@ -276,7 +277,6 @@ namespace Flow.Launcher.ViewModel
|
|||
Owner = Application.Current.MainWindow
|
||||
};
|
||||
|
||||
//MainWindowVisibility = Visibility.Collapsed;
|
||||
Hide();
|
||||
|
||||
PluginManager
|
||||
|
|
@ -368,7 +368,6 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
|
||||
public Visibility ProgressBarVisibility { get; set; }
|
||||
|
||||
public Visibility MainWindowVisibility { get; set; }
|
||||
|
||||
public ICommand EscCommand { get; set; }
|
||||
|
|
@ -735,7 +734,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
#endregion
|
||||
|
||||
public void OnHotkey()
|
||||
public void OnHotkey(object sender, HotkeyEventArgs e)
|
||||
{
|
||||
if (!ShouldIgnoreHotkeys())
|
||||
{
|
||||
|
|
@ -765,7 +764,7 @@ namespace Flow.Launcher.ViewModel
|
|||
/// <summary>
|
||||
/// Checks if Flow Launcher should ignore any hotkeys
|
||||
/// </summary>
|
||||
private bool ShouldIgnoreHotkeys()
|
||||
public bool ShouldIgnoreHotkeys()
|
||||
{
|
||||
return _settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue