Table of Contents

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

minOffset TimeSpan

The 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

TimeSpan

Properties

LastExecutionTime

The last execution time that was registered.

public DateTime LastExecutionTime { get; }

Property Value

DateTime

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

register bool

If true, the current time will be registered as the last execution time, only if this method also returns true.

Returns

bool

true if the elapsed time since the last execution is greater than the minimum required offset, otherwise false.