Table of Contents

Class MainLoop

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Simple main loop implementation that can be used to monitor file descriptor, run timers and idle handlers.

public class MainLoop
Inheritance
MainLoop
Inherited Members

Remarks

Monitoring of file descriptors is only available on Unix, there does not seem to be a way of supporting this on Windows.

Constructors

MainLoop(IMainLoopDriver)

Creates a new Mainloop.

Properties

Driver

The current IMainLoopDriver in use.

IdleHandlers

Gets a copy of the list of all idle handlers.

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

AddIdle(Func<bool>)

Adds specified idle handler function to mainloop processing. The handler function will be called once per iteration of the main loop after other events have been handled.

AddTimeout(TimeSpan, Func<MainLoop, bool>)

Adds a timeout to the mainloop.

EventsPending(bool)

Determines whether there are pending events to be processed.

Invoke(Action)

Runs action on the thread that is processing events

MainIteration()

Runs one iteration of timers and file watches

RemoveIdle(Func<bool>)

Removes an idle handler added with AddIdle(Func<bool>) from processing.

RemoveTimeout(object)

Removes a previously scheduled timeout

Run()

Runs the mainloop.

Stop()

Stops the mainloop.

Events

TimeoutAdded

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