From 4df1e418d7e3f2d1d5e46b7deec31f6e4c64d011 Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 22 Nov 2021 16:49:06 +0900 Subject: [PATCH] Revert "- Remove visible/collapsed code (only using opacity)" This reverts commit e282fc5d3843a20db6b5bee38620fd2584188846. --- Flow.Launcher/MainWindow.xaml.cs | 4 ++++ Flow.Launcher/ViewModel/MainViewModel.cs | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 6245d4a36..b1a23a79c 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -348,12 +348,16 @@ namespace Flow.Launcher private async void OnContextMenusForSettingsClick(object sender, RoutedEventArgs e) { _viewModel.Hide(); + await Task.Delay(50); App.API.OpenSettingDialog(); } private async void OnDeactivated(object sender, EventArgs e) { + // need time to initialize the main query window animation + if (_settings.UseAnimation) + await Task.Delay(50); if (_settings.HideWhenDeactive) { _viewModel.Hide(); diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 61326d911..c0074f1a9 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -702,7 +702,7 @@ namespace Flow.Launcher.ViewModel public void Show() { ((MainWindow)Application.Current.MainWindow).WindowAnimator(); - //MainWindowVisibility = Visibility.Visible; + MainWindowVisibility = Visibility.Visible; WinToggleStatus = true; MainWindowOpacity = 1; } @@ -714,20 +714,29 @@ namespace Flow.Launcher.ViewModel case LastQueryMode.Empty: ChangeQueryText(string.Empty); MainWindowOpacity = 0; // Trick for no delay + await Task.Delay(50); //Time for change to opacity break; case LastQueryMode.Preserved: MainWindowOpacity = 0; + if (_settings.UseAnimation) + { + await Task.Delay(50); + } LastQuerySelected = true; break; case LastQueryMode.Selected: MainWindowOpacity = 0; + if (_settings.UseAnimation) + { + await Task.Delay(50); + } LastQuerySelected = false; break; default: throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>"); } WinToggleStatus = false; - MainWindowOpacity = 0; + MainWindowVisibility = Visibility.Collapsed; } #endregion