From e500b3517d1993b391f88577de6c1cafdae4e7aa Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Fri, 19 Nov 2021 14:24:28 +0900 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Jeremy Wu --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 1 - Flow.Launcher/Flow.Launcher.csproj | 1 - Flow.Launcher/MainWindow.xaml.cs | 8 +++----- Flow.Launcher/SettingWindow.xaml.cs | 1 - Flow.Launcher/ViewModel/MainViewModel.cs | 2 +- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 89d2d32aa..0816d7626 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -85,7 +85,6 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool UseAnimation { get; set; } = true; public bool UseSound { get; set; } = true; - /// /// when false Alphabet static service will always return empty results /// diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 1f24b325f..f431504c2 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -77,7 +77,6 @@ Designer PreserveNewest - PreserveNewest diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 46db842df..82afdc2b2 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -274,7 +274,6 @@ namespace Flow.Launcher } } - private void OnMouseDown(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) DragMove(); @@ -318,7 +317,9 @@ namespace Flow.Launcher private async void OnDeactivated(object sender, EventArgs e) { _viewModel.Save(); - await Task.Delay(100); + // need time to initialize the main query window animation + if (_settings.UseAnimation) + await Task.Delay(100); if (_settings.HideWhenDeactive) { _viewModel.Hide(); @@ -339,11 +340,9 @@ namespace Flow.Launcher { Left = WindowLeft(); Top = WindowTop(); - } } - private void OnLocationChanged(object sender, EventArgs e) { if (_animating) @@ -366,7 +365,6 @@ namespace Flow.Launcher { _viewModel.Show(); } - } public double WindowLeft() diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 88d4f2895..6d280ea3e 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -44,7 +44,6 @@ namespace Flow.Launcher HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource; HwndTarget hwndTarget = hwndSource.CompositionTarget; hwndTarget.RenderMode = RenderMode.SoftwareOnly; - } private void OnAutoStartupChecked(object sender, RoutedEventArgs e) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 9870053c2..aa0efdca6 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -758,9 +758,9 @@ namespace Flow.Launcher.ViewModel default: throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>"); } + WinToggleStatus = false; MainWindowVisibility = Visibility.Collapsed; - } #endregion