File tree Expand file tree Collapse file tree
Source/NETworkManager.Utilities.WPF Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,20 +23,26 @@ public static bool GetIsReloading(UIElement element) =>
2323
2424 private static void OnIsReloadingChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
2525 {
26- if ( d is Rectangle rect && e . NewValue is bool isReloading )
26+ if ( d is not Rectangle rect || e . NewValue is not bool isReloading )
27+ return ;
28+
29+ if ( isReloading )
2730 {
28- if ( isReloading )
31+ var rotate = new RotateTransform
2932 {
30- var rotate = new RotateTransform { CenterX = 12 , CenterY = 12 } ;
31- rect . RenderTransform = rotate ;
33+ CenterX = rect . Width / 2 ,
34+ CenterY = rect . Height / 2
35+ } ;
36+
37+ rect . RenderTransform = rotate ;
3238
33- var animation = new DoubleAnimation ( 0 , 720 , new Duration ( TimeSpan . FromSeconds ( 2 ) ) ) ;
34- rotate . BeginAnimation ( RotateTransform . AngleProperty , animation ) ;
35- }
36- else
37- {
38- rect . RenderTransform = null ;
39- }
39+ var animation = new DoubleAnimation ( 0 , 720 , new Duration ( TimeSpan . FromSeconds ( 2 ) ) ) ;
40+
41+ rotate . BeginAnimation ( RotateTransform . AngleProperty , animation ) ;
42+ }
43+ else
44+ {
45+ rect . RenderTransform = null ;
4046 }
4147 }
4248}
You can’t perform that action at this time.
0 commit comments