Table of Contents

Class TimedEvents

Namespace
Terminal.Gui.App
Assembly
Terminal.Gui.dll

Manages scheduled timeouts (timed callbacks) for the application.

Allows scheduling of callbacks to be invoked after a specified delay, with optional repetition. Timeouts are stored in a sorted list by their scheduled execution time (UTC ticks). Thread-safe for concurrent access.

Typical usage:

  1. Call Add(TimeSpan, Func<bool>) to schedule a callback.
  2. Call RunTimers() periodically (e.g., from the main loop) to execute due callbacks.
  3. Call Remove(object) to cancel a scheduled timeout.
public class TimedEvents : ITimedEvents
Inheritance
TimedEvents
Implements
Inherited Members

Properties

Timeouts

Gets the list of all timeouts sorted by the TimeSpan time ticks. A shorter limit time can be added at the end, but it will be called before an earlier addition that has a longer limit time.

Methods

Add(TimeSpan, Func<bool>)

Adds a timeout to the application.

Add(Timeout)

Adds a timeout to the application.

CheckTimers(out int)

Called from Terminal.Gui.App.IMainLoopDriver.EventsPending() to check if there are any outstanding timer handlers.

Remove(object)

Removes a previously scheduled timeout.

RunTimers()

Runs all timeouts that are due.

Events

Added

Invoked when a new timeout is added. To be used in the case when EndAfterFirstIteration is true.