Skip to content

Commit 711865d

Browse files
committed
Use local variable for storyboard
1 parent 95f151b commit 711865d

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,31 @@ public partial class MainWindow
3131
{
3232
#region Private Fields
3333

34+
// Dependency Injection
3435
private readonly Settings _settings;
3536
private readonly Theme _theme;
37+
38+
// Window Notify Icon
3639
private NotifyIcon _notifyIcon;
40+
41+
// Window Context Menu
3742
private readonly ContextMenu contextMenu = new();
3843
private readonly MainViewModel _viewModel;
39-
private bool _animating;
44+
45+
// Window Event : Key Event
4046
private bool isArrowKeyPressed = false;
4147

48+
// Window Sound Effects
4249
private MediaPlayer animationSoundWMP;
4350
private SoundPlayer animationSoundWPF;
4451

52+
// Window WndProc
4553
private int _initialWidth;
4654
private int _initialHeight;
4755

48-
// Window Animations
49-
private Storyboard clocksb;
50-
private Storyboard iconsb;
51-
private Storyboard windowsb;
56+
// Window Animation
57+
private const double DefaultRightMargin = 66; //* this value from base.xaml
58+
private bool _animating;
5259
private bool _isClockPanelAnimating = false; // 애니메이션 실행 중인지 여부
5360

5461
#endregion
@@ -742,9 +749,9 @@ private void WindowAnimation()
742749
ClockPanel.Opacity = 0;
743750
SearchIcon.Opacity = 0;
744751

745-
windowsb = new Storyboard();
746-
clocksb = new Storyboard();
747-
iconsb = new Storyboard();
752+
var windowsb = new Storyboard();
753+
var clocksb = new Storyboard();
754+
var iconsb = new Storyboard();
748755
CircleEase easing = new CircleEase { EasingMode = EasingMode.EaseInOut };
749756

750757
var animationLength = _settings.AnimationSpeed switch
@@ -799,8 +806,7 @@ private void WindowAnimation()
799806
Duration = TimeSpan.FromMilliseconds(animationLength),
800807
FillBehavior = FillBehavior.HoldEnd
801808
};
802-
803-
const double DefaultRightMargin = 66; //* this value from base.xaml
809+
804810
double rightMargin = GetThicknessFromStyle(ClockPanel.Style, new Thickness(0, 0, DefaultRightMargin, 0)).Right;
805811

806812
var thicknessAnimation = new ThicknessAnimation
@@ -819,10 +825,10 @@ private void WindowAnimation()
819825
Storyboard.SetTargetProperty(thicknessAnimation, new PropertyPath(MarginProperty));
820826

821827
Storyboard.SetTarget(WindowOpacity, this);
822-
Storyboard.SetTargetProperty(WindowOpacity, new PropertyPath(Window.OpacityProperty));
828+
Storyboard.SetTargetProperty(WindowOpacity, new PropertyPath(OpacityProperty));
823829

824830
Storyboard.SetTarget(WindowMotion, this);
825-
Storyboard.SetTargetProperty(WindowMotion, new PropertyPath(Window.TopProperty));
831+
Storyboard.SetTargetProperty(WindowMotion, new PropertyPath(TopProperty));
826832

827833
Storyboard.SetTarget(IconMotion, SearchIcon);
828834
Storyboard.SetTargetProperty(IconMotion, new PropertyPath(TopProperty));

0 commit comments

Comments
 (0)