mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Code formatting
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user