From 102e7cb1b93c4d29bdd891291b2cf88e770c778c Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 31 Oct 2021 17:18:03 +0900 Subject: [PATCH 1/5] Fix HideonStartup (#783) --- Flow.Launcher/ViewModel/MainViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 4588a677fe9..2e0eb492415 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -729,7 +729,7 @@ public void Hide() { if (MainWindowVisibility != Visibility.Collapsed) { - ToggleFlowLauncher(); + MainWindowVisibility = Visibility.Collapsed; } } From 58c599e748860e48fefea59b3a30fb8bbddfbe3f Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 1 Nov 2021 04:35:58 +0900 Subject: [PATCH 2/5] Move "HideEmptyQuery" from toggleflow to hide. --- Flow.Launcher/ViewModel/MainViewModel.cs | 39 +++++++++++------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 4588a677fe9..fde5bb467b6 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -704,33 +704,30 @@ public async void ToggleFlowLauncher() } else { - switch (_settings.LastQueryMode) - { - case LastQueryMode.Empty: - ChangeQueryText(string.Empty); - Application.Current.MainWindow.Opacity = 0; // Trick for no delay - await Task.Delay(100); - Application.Current.MainWindow.Opacity = 1; - break; - case LastQueryMode.Preserved: - LastQuerySelected = true; - break; - case LastQueryMode.Selected: - LastQuerySelected = false; - break; - default: - throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>"); - } - MainWindowVisibility = Visibility.Collapsed; + Hide(); } } - public void Hide() + public async void Hide() { - if (MainWindowVisibility != Visibility.Collapsed) + switch (_settings.LastQueryMode) { - ToggleFlowLauncher(); + case LastQueryMode.Empty: + ChangeQueryText(string.Empty); + Application.Current.MainWindow.Opacity = 0; // Trick for no delay + await Task.Delay(100); + Application.Current.MainWindow.Opacity = 1; + break; + case LastQueryMode.Preserved: + LastQuerySelected = true; + break; + case LastQueryMode.Selected: + LastQuerySelected = false; + break; + default: + throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>"); } + MainWindowVisibility = Visibility.Collapsed; } #endregion From 5aeab2456b8aceb150f7756d6c32cb86287a3cfb Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 1 Nov 2021 07:33:59 +0900 Subject: [PATCH 3/5] add force closin --- Flow.Launcher/MainWindow.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 057c3f07d09..16c9fd05cdf 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -53,7 +53,7 @@ private async void OnClosing(object sender, CancelEventArgs e) _viewModel.Save(); e.Cancel = true; await PluginManager.DisposePluginsAsync(); - Application.Current.Shutdown(); + Environment.Exit(0); } private void OnInitialized(object sender, EventArgs e) @@ -185,7 +185,7 @@ private void InitializeNotifyIcon() var setting = items.Add(InternationalizationManager.Instance.GetTranslation("iconTraySettings")); setting.Click += (o, e) => App.API.OpenSettingDialog(); var exit = items.Add(InternationalizationManager.Instance.GetTranslation("iconTrayExit")); - exit.Click += (o, e) => Close(); + exit.Click += (o, e) => Environment.Exit(0); _notifyIcon.ContextMenuStrip = menu; _notifyIcon.MouseClick += (o, e) => From e04284a013d681a3f1fc6d9e5f22819219807e35 Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 1 Nov 2021 07:33:59 +0900 Subject: [PATCH 4/5] add force closing --- Flow.Launcher/MainWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 057c3f07d09..b0e3492d27d 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -53,7 +53,7 @@ private async void OnClosing(object sender, CancelEventArgs e) _viewModel.Save(); e.Cancel = true; await PluginManager.DisposePluginsAsync(); - Application.Current.Shutdown(); + Environment.Exit(0); } private void OnInitialized(object sender, EventArgs e) From a4327122ec68db96eaae69a39ac82635db627a6b Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Fri, 5 Nov 2021 12:31:05 -0500 Subject: [PATCH 5/5] Revert change to close command and remove async in ToggleFlow --- Flow.Launcher/MainWindow.xaml.cs | 2 +- Flow.Launcher/ViewModel/MainViewModel.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 16c9fd05cdf..b0e3492d27d 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -185,7 +185,7 @@ private void InitializeNotifyIcon() var setting = items.Add(InternationalizationManager.Instance.GetTranslation("iconTraySettings")); setting.Click += (o, e) => App.API.OpenSettingDialog(); var exit = items.Add(InternationalizationManager.Instance.GetTranslation("iconTrayExit")); - exit.Click += (o, e) => Environment.Exit(0); + exit.Click += (o, e) => Close(); _notifyIcon.ContextMenuStrip = menu; _notifyIcon.MouseClick += (o, e) => diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index fde5bb467b6..99436a6ab18 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -273,7 +273,7 @@ private void InitializeKeyCommands() ReloadPluginDataCommand = new RelayCommand(_ => { Hide(); - + PluginManager .ReloadData() .ContinueWith(_ => @@ -315,7 +315,7 @@ public string QueryText /// public void ChangeQueryText(string queryText, bool reQuery = false) { - if (QueryText!=queryText) + if (QueryText != queryText) { // re-query is done in QueryText's setter method QueryText = queryText; @@ -696,7 +696,7 @@ private void SetOpenResultModifiers() OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers; } - public async void ToggleFlowLauncher() + public void ToggleFlowLauncher() { if (MainWindowVisibility != Visibility.Visible) {