Table of Contents

Class DefaultRenderTimer

Namespace
Avalonia.Rendering
Assembly
Avalonia.Base.dll

Defines a default render timer that uses a standard timer.

[PrivateApi]
public class DefaultRenderTimer : IRenderTimer
Inheritance
DefaultRenderTimer
Implements
Derived
Inherited Members

Remarks

This class may be overridden by platform implementations to use a specialized timer implementation.

Constructors

DefaultRenderTimer(int)

Initializes a new instance of the DefaultRenderTimer class.

public DefaultRenderTimer(int framesPerSecond)

Parameters

framesPerSecond int

The number of frames per second at which the loop should run.

Properties

FramesPerSecond

Gets the number of frames per second at which the loop runs.

public int FramesPerSecond { get; }

Property Value

int

RunsInBackground

Indicates if the timer ticks on a non-UI thread

public virtual bool RunsInBackground { get; }

Property Value

bool

Methods

Start()

Starts the timer.

protected void Start()

StartCore(Action<TimeSpan>)

Provides the implementation of starting the timer.

protected virtual IDisposable StartCore(Action<TimeSpan> tick)

Parameters

tick Action<TimeSpan>

The method to call on each tick.

Returns

IDisposable

Remarks

This can be overridden by platform implementations to use a specialized timer implementation.

Stop()

Stops the timer.

protected void Stop()

Events

Tick

Raised when the render timer ticks to signal a new frame should be drawn.

public event Action<TimeSpan> Tick

Event Type

Action<TimeSpan>

Remarks

This event can be raised on any thread; it is the responsibility of the subscriber to switch execution to the right thread.