From e282fc5d3843a20db6b5bee38620fd2584188846 Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 22 Nov 2021 15:45:08 +0900 Subject: [PATCH] - Remove visible/collapsed code (only using opacity) - Remove All Delay --- Flow.Launcher/MainWindow.xaml.cs | 4 ---- Flow.Launcher/ViewModel/MainViewModel.cs | 13 ++----------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index b1a23a79c..6245d4a36 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -348,16 +348,12 @@ 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 c0074f1a9..61326d911 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,29 +714,20 @@ 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; - MainWindowVisibility = Visibility.Collapsed; + MainWindowOpacity = 0; } #endregion