66// </copyright>
77// <summary>Displays a busy animation.</summary>
88//-----------------------------------------------------------------------
9+ using System . ComponentModel ;
910using System . Windows ;
1011using System . Windows . Controls ;
1112using System . Windows . Media ;
1213using System . Windows . Threading ;
13- using System . ComponentModel ;
1414
1515namespace Csla . Xaml
1616{
@@ -36,15 +36,15 @@ namespace Csla.Xaml
3636 [ TemplateVisualState ( Name = "state8" , GroupName = "CommonStates" ) ]
3737 public class BusyAnimation : Control
3838 {
39- #region Constants
39+ #region Constants
4040
4141 private const int NUM_STATES = 8 ;
4242
43- #endregion
43+ #endregion
4444
45- #region Member fields and properties
45+ #region Member fields and properties
4646
47- private DispatcherTimer _timer ;
47+ private DispatcherTimer ? _timer ;
4848 private int _state = - 1 ;
4949
5050 /// <summary>
@@ -56,7 +56,7 @@ public class BusyAnimation : Control
5656 typeof ( BusyAnimation ) ,
5757 new PropertyMetadata (
5858 TimeSpan . FromMilliseconds ( 100 ) ,
59- ( o , e ) =>
59+ ( o , e ) =>
6060 {
6161 var busyAnimation = ( BusyAnimation ) o ;
6262 busyAnimation . StepInterval = ( TimeSpan ) e . NewValue ;
@@ -106,9 +106,9 @@ private void SetupRunningState(bool isRunning)
106106 GoToState ( true ) ;
107107 }
108108
109- #endregion
109+ #endregion
110110
111- #region Constructor
111+ #region Constructor
112112
113113 /// <summary>
114114 /// Creates an instance of the control.
@@ -125,9 +125,9 @@ public BusyAnimation()
125125 LayoutUpdated += BusyAnimation_LayoutUpdated ;
126126 }
127127
128- #endregion
128+ #endregion
129129
130- #region Timer
130+ #region Timer
131131
132132 private void StartTimer ( )
133133 {
@@ -150,7 +150,7 @@ private void StopTimer()
150150 }
151151 }
152152
153- void timer_Tick ( object sender , EventArgs e )
153+ void timer_Tick ( object ? sender , EventArgs e )
154154 {
155155 _state ++ ;
156156 if ( _state >= NUM_STATES )
@@ -159,9 +159,9 @@ void timer_Tick(object sender, EventArgs e)
159159 GoToState ( true ) ;
160160 }
161161
162- #endregion
162+ #endregion
163163
164- #region State
164+ #region State
165165
166166 private void GoToState ( bool useTransitions )
167167 {
@@ -175,16 +175,16 @@ private void GoToState(bool useTransitions)
175175 }
176176 }
177177
178- #endregion
178+ #endregion
179179
180- #region Parts
180+ #region Parts
181181
182- void BusyAnimation_LayoutUpdated ( object sender , EventArgs e )
182+ void BusyAnimation_LayoutUpdated ( object ? sender , EventArgs e )
183183 {
184184 ArrangeParts ( ) ;
185185 }
186186
187- void BusyAnimation_SizeChanged ( object sender , SizeChangedEventArgs e )
187+ void BusyAnimation_SizeChanged ( object ? sender , SizeChangedEventArgs e )
188188 {
189189 ArrangeParts ( ) ;
190190 }
@@ -196,7 +196,7 @@ private void ArrangeParts()
196196
197197 for ( int n = 0 ; n < NUM_STATES ; n ++ )
198198 {
199- FrameworkElement item = ( FrameworkElement ) FindChild ( this , "part" + ( n + 1 ) ) ;
199+ var item = ( FrameworkElement ? ) FindChild ( this , "part" + ( n + 1 ) ) ;
200200 if ( item != null )
201201 {
202202 double itemTheta = theta * n ;
@@ -215,30 +215,31 @@ private void ArrangeParts()
215215 }
216216 }
217217
218- #endregion
218+ #endregion
219219
220- #region Helpers
220+ #region Helpers
221221
222- private DependencyObject FindChild ( DependencyObject parent , string name )
222+ private DependencyObject ? FindChild ( DependencyObject parent , string name )
223223 {
224- DependencyObject found = null ;
224+ DependencyObject ? found = null ;
225225 int count = VisualTreeHelper . GetChildrenCount ( parent ) ;
226226 for ( int x = 0 ; x < count ; x ++ )
227227 {
228228 DependencyObject child = VisualTreeHelper . GetChild ( parent , x ) ;
229- string childName = child . GetValue ( NameProperty ) as string ;
229+ string ? childName = child . GetValue ( NameProperty ) as string ;
230230 if ( childName == name )
231231 {
232232 found = child ;
233233 break ;
234234 }
235- else found = FindChild ( child , name ) ;
235+ else
236+ found = FindChild ( child , name ) ;
236237 }
237238
238239 return found ;
239240 }
240241
241- #endregion
242+ #endregion
242243 }
243244}
244245#endif
0 commit comments