Table of Contents

Class FrameTimer

Namespace
RisingV.Shared
Assembly
RisingV.Shared.dll

FrameTimer is a utility class that allows you to run an action after a specified delay, with the option to repeat it a certain number of times.

public class FrameTimer
Inheritance
FrameTimer
Inherited Members
Extension Methods

Properties

Enabled

public bool Enabled { get; }

Property Value

bool

TimeSinceLastRun

Gets the delay between calls. This will not be called more frequently than this delay, but it might be called longer if the delay is greater than the time between frames.

public TimeSpan TimeSinceLastRun { get; }

Property Value

TimeSpan

Methods

Initialize(Action, Func<TimeSpan>, int)

Initializes the FrameTimer with a delay generator function.

public FrameTimer Initialize(Action action, Func<TimeSpan> delayGenerator, int runCount = 1)

Parameters

action Action

The action to perform after the delay.

delayGenerator Func<TimeSpan>

A function that generates the delay as a TimeSpan.

runCount int

The number of times to run the action. A negative value will cause the action to run indefinitely.

Returns

FrameTimer

Returns the FrameTimer instance for method chaining.

Initialize(Action, TimeSpan, int)

public FrameTimer Initialize(Action action, TimeSpan delay, int runCount = 1)

Parameters

action Action

the action that is performed

delay TimeSpan

the delay between calls. This will not be called more frequently than this delay, but it might be called longer if the delay is greater than the time between frames

runCount int

the amount of times to perform the action. Negative numbers will cause the action to run infinitely

Returns

FrameTimer

Start()

Starts the FrameTimer.

public void Start()

Stop()

Stops the FrameTimer.

public void Stop()