1
1
using System ;
2
2
using System . ComponentModel ;
3
- using System . Diagnostics ;
4
3
using System . Linq ;
5
4
using System . Media ;
6
5
using System . Threading . Tasks ;
@@ -76,7 +75,7 @@ public MainWindow()
76
75
DataContext = _viewModel ;
77
76
78
77
InitializeComponent ( ) ;
79
- UpdatePosition ( true ) ;
78
+ UpdatePosition ( ) ;
80
79
81
80
InitSoundEffects ( ) ;
82
81
DataObject . AddPastingHandler ( QueryTextBox , QueryTextBox_OnPaste ) ;
@@ -112,7 +111,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
112
111
}
113
112
114
113
// Hide window if need
115
- UpdatePosition ( true ) ;
114
+ UpdatePosition ( ) ;
116
115
if ( _settings . HideOnStartup )
117
116
{
118
117
_viewModel . Hide ( ) ;
@@ -139,7 +138,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
139
138
InitProgressbarAnimation ( ) ;
140
139
141
140
// Force update position
142
- UpdatePosition ( true ) ;
141
+ UpdatePosition ( ) ;
143
142
144
143
// Refresh frame
145
144
await Ioc . Default . GetRequiredService < Theme > ( ) . RefreshFrameAsync ( ) ;
@@ -167,7 +166,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
167
166
SoundPlay ( ) ;
168
167
}
169
168
170
- UpdatePosition ( false ) ;
169
+ UpdatePosition ( ) ;
171
170
_viewModel . ResetPreview ( ) ;
172
171
Activate ( ) ;
173
172
QueryTextBox . Focus ( ) ;
@@ -269,7 +268,6 @@ private void OnClosed(object sender, EventArgs e)
269
268
270
269
private void OnLocationChanged ( object sender , EventArgs e )
271
270
{
272
-
273
271
if ( _settings . SearchWindowScreen == SearchWindowScreens . RememberLastLaunchLocation )
274
272
{
275
273
_settings . WindowLeft = Left ;
@@ -281,17 +279,18 @@ private async void OnDeactivated(object sender, EventArgs e)
281
279
{
282
280
_settings . WindowLeft = Left ;
283
281
_settings . WindowTop = Top ;
282
+
284
283
ClockPanel . Opacity = 0 ;
285
284
SearchIcon . Opacity = 0 ;
286
- //This condition stops extra hide call when animator is on,
285
+
286
+ // This condition stops extra hide call when animator is on,
287
287
// which causes the toggling to occasional hide instead of show.
288
288
if ( _viewModel . MainWindowVisibilityStatus )
289
289
{
290
290
// Need time to initialize the main query window animation.
291
291
// This also stops the mainwindow from flickering occasionally after Settings window is opened
292
292
// and always after Settings window is closed.
293
293
if ( _settings . UseAnimation )
294
-
295
294
await Task . Delay ( 100 ) ;
296
295
297
296
if ( _settings . HideWhenDeactivated && ! _viewModel . ExternalPreviewVisible )
@@ -589,13 +588,8 @@ private void UpdateNotifyIconText()
589
588
590
589
#region Window Position
591
590
592
- private void UpdatePosition ( bool force )
591
+ private void UpdatePosition ( )
593
592
{
594
- if ( ! force )
595
- {
596
- return ;
597
- }
598
-
599
593
// Initialize call twice to work around multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910
600
594
InitializePosition ( ) ;
601
595
InitializePosition ( ) ;
@@ -770,20 +764,16 @@ private void InitProgressbarAnimation()
770
764
public void WindowAnimation ( )
771
765
{
772
766
_isArrowKeyPressed = true ;
773
- UpdatePosition ( false ) ;
774
- if ( _settings . UseAnimation )
775
- {
776
- ClockPanel . Opacity = 0 ;
777
- SearchIcon . Opacity = 0 ;
778
- }
779
- else
780
- {
781
- ClockPanel . Opacity = 1 ;
782
- SearchIcon . Opacity = 1 ;
783
- }
767
+
768
+ UpdatePosition ( ) ;
769
+
770
+ var opacity = _settings . UseAnimation ? 0.0 : 1.0 ;
771
+ ClockPanel . Opacity = opacity ;
772
+ SearchIcon . Opacity = opacity ;
773
+
784
774
var clocksb = new Storyboard ( ) ;
785
775
var iconsb = new Storyboard ( ) ;
786
- CircleEase easing = new CircleEase { EasingMode = EasingMode . EaseInOut } ;
776
+ var easing = new CircleEase { EasingMode = EasingMode . EaseInOut } ;
787
777
788
778
var animationLength = _settings . AnimationSpeed switch
789
779
{
@@ -811,7 +801,7 @@ public void WindowAnimation()
811
801
FillBehavior = FillBehavior . HoldEnd
812
802
} ;
813
803
814
- double TargetIconOpacity = GetOpacityFromStyle ( SearchIcon . Style , 1.0 ) ;
804
+ var TargetIconOpacity = GetOpacityFromStyle ( SearchIcon . Style , 1.0 ) ;
815
805
816
806
var IconOpacity = new DoubleAnimation
817
807
{
@@ -822,7 +812,7 @@ public void WindowAnimation()
822
812
FillBehavior = FillBehavior . HoldEnd
823
813
} ;
824
814
825
- double rightMargin = GetThicknessFromStyle ( ClockPanel . Style , new Thickness ( 0 , 0 , DefaultRightMargin , 0 ) ) . Right ;
815
+ var rightMargin = GetThicknessFromStyle ( ClockPanel . Style , new Thickness ( 0 , 0 , DefaultRightMargin , 0 ) ) . Right ;
826
816
827
817
var thicknessAnimation = new ThicknessAnimation
828
818
{
0 commit comments