1- using System ;
1+ using System ;
22using System . Windows ;
33using System . Windows . Input ;
44using System . Windows . Interop ;
@@ -27,6 +27,7 @@ public partial class SearchWindow
2727 public event EventHandler < ShowingEventArgs > ? Showing ;
2828
2929 private bool _isFirstShow = true ;
30+ private bool _isHiding ;
3031 private readonly SearchWindowViewModel _viewModel ;
3132 private readonly SearchWindowController _controller ;
3233 private readonly SearchWindowAnimator _animator ;
@@ -83,14 +84,16 @@ private void OpenSearchInEverything(object? sender, RoutedEventArgs e)
8384
8485 internal void Show ( ShowOptions options )
8586 {
86- if ( Visibility == Visibility . Visible )
87+ if ( Visibility == Visibility . Visible && ! _isHiding )
8788 {
8889 if ( options . Activate )
8990 ActivateAndBringToFront ( ) ;
9091
9192 return ;
9293 }
9394
95+ _isHiding = false ;
96+
9497 if ( _isFirstShow )
9598 PreWarm ( ) ;
9699
@@ -107,9 +110,10 @@ internal void Show(ShowOptions options)
107110
108111 internal void HideAnimated ( )
109112 {
110- if ( Visibility != Visibility . Visible )
113+ if ( Visibility != Visibility . Visible || _isHiding )
111114 return ;
112115
116+ _isHiding = true ;
113117 Hiding ? . Invoke ( this , EventArgs . Empty ) ;
114118 }
115119
@@ -120,6 +124,7 @@ internal void FocusSearchBox()
120124
121125 private void OnHidden ( )
122126 {
127+ _isHiding = false ;
123128 _viewModel . SavePopupSize ( ( int ) Width , ( int ) Height ) ;
124129
125130 // Push outside of screens to hide Windows' closing animation
0 commit comments