Skip to content

Commit ad5f34f

Browse files
authored
Merge pull request #784 from onesounds/FixHIdeStartup
Force Exit & Fix HideonStartup (#783)
2 parents 74aa9e4 + a432712 commit ad5f34f

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private async void OnClosing(object sender, CancelEventArgs e)
5555
_viewModel.Save();
5656
e.Cancel = true;
5757
await PluginManager.DisposePluginsAsync();
58-
Application.Current.Shutdown();
58+
Environment.Exit(0);
5959
}
6060

6161
private void OnInitialized(object sender, EventArgs e)

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ private void InitializeKeyCommands()
273273
ReloadPluginDataCommand = new RelayCommand(_ =>
274274
{
275275
Hide();
276-
276+
277277
PluginManager
278278
.ReloadData()
279279
.ContinueWith(_ =>
@@ -315,7 +315,7 @@ public string QueryText
315315
/// <param name="queryText"></param>
316316
public void ChangeQueryText(string queryText, bool reQuery = false)
317317
{
318-
if (QueryText!=queryText)
318+
if (QueryText != queryText)
319319
{
320320
// re-query is done in QueryText's setter method
321321
QueryText = queryText;
@@ -696,41 +696,38 @@ private void SetOpenResultModifiers()
696696
OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers;
697697
}
698698

699-
public async void ToggleFlowLauncher()
699+
public void ToggleFlowLauncher()
700700
{
701701
if (MainWindowVisibility != Visibility.Visible)
702702
{
703703
MainWindowVisibility = Visibility.Visible;
704704
}
705705
else
706706
{
707-
switch (_settings.LastQueryMode)
708-
{
709-
case LastQueryMode.Empty:
710-
ChangeQueryText(string.Empty);
711-
Application.Current.MainWindow.Opacity = 0; // Trick for no delay
712-
await Task.Delay(100);
713-
Application.Current.MainWindow.Opacity = 1;
714-
break;
715-
case LastQueryMode.Preserved:
716-
LastQuerySelected = true;
717-
break;
718-
case LastQueryMode.Selected:
719-
LastQuerySelected = false;
720-
break;
721-
default:
722-
throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>");
723-
}
724-
MainWindowVisibility = Visibility.Collapsed;
707+
Hide();
725708
}
726709
}
727710

728-
public void Hide()
711+
public async void Hide()
729712
{
730-
if (MainWindowVisibility != Visibility.Collapsed)
713+
switch (_settings.LastQueryMode)
731714
{
732-
ToggleFlowLauncher();
715+
case LastQueryMode.Empty:
716+
ChangeQueryText(string.Empty);
717+
Application.Current.MainWindow.Opacity = 0; // Trick for no delay
718+
await Task.Delay(100);
719+
Application.Current.MainWindow.Opacity = 1;
720+
break;
721+
case LastQueryMode.Preserved:
722+
LastQuerySelected = true;
723+
break;
724+
case LastQueryMode.Selected:
725+
LastQuerySelected = false;
726+
break;
727+
default:
728+
throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>");
733729
}
730+
MainWindowVisibility = Visibility.Collapsed;
734731
}
735732

736733
#endregion

0 commit comments

Comments
 (0)