Class ActionTimer
- Namespace
- Garyon.Mechanisms
- Assembly
- Garyon.dll
Provides the ability to determine if a minimum timespan has elapsed since the last successful registration of the time an action was executed.
public sealed class ActionTimer
- Inheritance
-
ActionTimer
- Inherited Members
- Extension Methods
Remarks
This does not hold any information about the action itself, nor is it required to be only used for one single action.
Constructors
ActionTimer(TimeSpan)
Provides the ability to determine if a minimum timespan has elapsed since the last successful registration of the time an action was executed.
public ActionTimer(TimeSpan minOffset)
Parameters
minOffsetTimeSpanThe minimum required elapsed time before successfully registering the next execution time.
Remarks
This does not hold any information about the action itself, nor is it required to be only used for one single action.
Fields
MinOffset
The minimum timespan that must be elapsed before registering the next valid execution time.
public TimeSpan MinOffset
Field Value
Properties
LastExecutionTime
The last execution time that was registered.
public DateTime LastExecutionTime { get; }
Property Value
Methods
Request(bool)
Requests the execution of an action based on the elapsed time. Optionally registers the current time as the last execution time.
public bool Request(bool register)
Parameters
registerboolIf true, the current time will be registered as the last execution time, only if this method also returns true.