Merge pull request #784 from onesounds/FixHIdeStartup

Force Exit & Fix HideonStartup (#783)
This commit is contained in:
Dobin Park 2021-11-08 09:47:13 +09:00 committed by GitHub
commit ad5f34f2dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 25 deletions

View file

@ -55,7 +55,7 @@ namespace Flow.Launcher
_viewModel.Save();
e.Cancel = true;
await PluginManager.DisposePluginsAsync();
Application.Current.Shutdown();
Environment.Exit(0);
}
private void OnInitialized(object sender, EventArgs e)

View file

@ -273,7 +273,7 @@ namespace Flow.Launcher.ViewModel
ReloadPluginDataCommand = new RelayCommand(_ =>
{
Hide();
PluginManager
.ReloadData()
.ContinueWith(_ =>
@ -315,7 +315,7 @@ namespace Flow.Launcher.ViewModel
/// <param name="queryText"></param>
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 @@ namespace Flow.Launcher.ViewModel
OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers;
}
public async void ToggleFlowLauncher()
public void ToggleFlowLauncher()
{
if (MainWindowVisibility != Visibility.Visible)
{
@ -704,33 +704,30 @@ namespace Flow.Launcher.ViewModel
}
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