Class TimerTick
This provides timing information similar to Stopwatch but an update occurring only on a Tick() method.
public class TimerTick
- Inheritance
-
objectTimerTick
Constructors
TimerTick()
Initializes a new instance of the TimerTick class.
public TimerTick()
TimerTick(TimeSpan)
Initializes a new instance of the TimerTick class.
public TimerTick(TimeSpan startTime)
Parameters
startTimeTimeSpanThe start time.
Properties
ElapsedTime
Gets the elapsed time since the previous call to Tick().
public TimeSpan ElapsedTime { get; }
Property Value
ElapsedTimeWithPause
public TimeSpan ElapsedTimeWithPause { get; }
Property Value
IsPaused
Gets a value indicating whether this instance is paused.
public bool IsPaused { get; }
Property Value
- bool
trueif this instance is paused; otherwise,false.
SpeedFactor
Gets or sets the speed factor. Default is 1.0
public double SpeedFactor { get; set; }
Property Value
- double
The speed factor.
StartTime
Gets the start time when this timer was created.
public TimeSpan StartTime { get; }
Property Value
TotalTime
Gets the total time elasped since the last reset or when this timer was created.
public TimeSpan TotalTime { get; }
Property Value
TotalTimeWithPause
Gets the total time elasped since the last reset or when this timer was created, including Pause()
public TimeSpan TotalTimeWithPause { get; }
Property Value
Methods
Pause()
Pauses this instance.
public void Pause()
Reset()
Resets this instance. TotalTime is set to zero.
public void Reset()
Reset(TimeSpan)
Resets this instance. TotalTime is set to startTime.
public void Reset(TimeSpan startTime)
Parameters
startTimeTimeSpanThe start time.
Resume()
Resumes this instance, only if a call to Pause() has been already issued.
public void Resume()
Tick()
Update the TotalTime and ElapsedTime,
public void Tick()
Remarks
This method must be called on a regular basis at every tick.