Code formatting

This commit is contained in:
tznind
2023-03-27 20:16:34 +01:00
parent e1e3e068e4
commit a0c02c6d1d
2 changed files with 15 additions and 15 deletions

View File

@@ -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;
}

View File

@@ -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);