浏览代码

Code formatting

tznind 2 年之前
父节点
当前提交
b41bf86df3
共有 2 个文件被更改,包括 15 次插入15 次删除
  1. 9 9
      Terminal.Gui/Views/SpinnerView.cs
  2. 6 6
      UnitTests/Views/SpinnerViewTests.cs

+ 9 - 9
Terminal.Gui/Views/SpinnerView.cs

@@ -11,9 +11,9 @@ namespace Terminal.Gui {
 	/// Use <see cref="AutoSpin"/> to make the automate calls to <see cref="View.SetNeedsDisplay()"/>.
 	/// </remarks>
 	public class SpinnerView : Label {
-		private Rune [] runes = new Rune [] { '|', '/', '\u2500', '\\' };
-		private int currentIdx = 0;
-		private DateTime lastRender = DateTime.MinValue;
+		private Rune [] _runes = new Rune [] { '|', '/', '\u2500', '\\' };
+		private int _currentIdx = 0;
+		private DateTime _lastRender = DateTime.MinValue;
 		private object _timeout;
 
 		/// <summary>
@@ -36,10 +36,10 @@ namespace Terminal.Gui {
 		/// <inheritdoc/>
 		public override void Redraw (Rect bounds)
 		{
-			if (DateTime.Now - lastRender > TimeSpan.FromMilliseconds (SpinDelayInMilliseconds)) {
-				currentIdx = (currentIdx + 1) % runes.Length;
-				Text = "" + runes [currentIdx];
-				lastRender = DateTime.Now;
+			if (DateTime.Now - _lastRender > TimeSpan.FromMilliseconds (SpinDelayInMilliseconds)) {
+				_currentIdx = (_currentIdx + 1) % _runes.Length;
+				Text = "" + _runes [_currentIdx];
+				_lastRender = DateTime.Now;
 			}
 
 			base.Redraw (bounds);
@@ -48,9 +48,9 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Automates spinning
 		/// </summary>
-		public void AutoSpin()
+		public void AutoSpin ()
 		{
-			if(_timeout != null) {
+			if (_timeout != null) {
 				return;
 			}
 

+ 6 - 6
UnitTests/Views/SpinnerViewTests.cs

@@ -13,13 +13,13 @@ namespace UnitTests.Views {
 		}
 
 
-		[Fact,AutoInitShutdown]
-		public void TestSpinnerView_ThrottlesAnimation()
+		[Fact, AutoInitShutdown]
+		public void TestSpinnerView_ThrottlesAnimation ()
 		{
 			var view = GetSpinnerView ();
 
 			view.Redraw (view.Bounds);
-			
+
 			var expected = "/";
 			TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
 
@@ -36,7 +36,7 @@ namespace UnitTests.Views {
 			TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
 		}
 		[Fact, AutoInitShutdown]
-		public void TestSpinnerView_NoThrottle()
+		public void TestSpinnerView_NoThrottle ()
 		{
 			var view = GetSpinnerView ();
 			view.SpinDelayInMilliseconds = 0;
@@ -57,8 +57,8 @@ namespace UnitTests.Views {
 
 		private SpinnerView GetSpinnerView ()
 		{
-			var view = new SpinnerView (); 
-			
+			var view = new SpinnerView ();
+
 			Application.Top.Add (view);
 			Application.Begin (Application.Top);