Table of Contents

Method Begin

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

Begin(IRunnable)

Building block API: Creates a SessionToken and prepares the provided IRunnable for execution. Not usually called directly by applications. Use Run(IRunnable, Func<Exception, bool>?) instead.

[Obsolete("The legacy static Application object is going away.")]
public static SessionToken Begin(IRunnable runnable)

Parameters

runnable IRunnable

The IRunnable to prepare execution for.

Returns

SessionToken

The SessionToken that needs to be passed to the End(SessionToken) method upon completion.

Remarks

This method prepares the provided IRunnable for running. It adds this to the SessionStack, lays out the SubViews, focuses the first element, and draws the runnable on the screen. This is usually followed by starting the main loop, and then the End(SessionToken) method upon termination which will undo these changes. It does not start the continuous main loop; use Run(IRunnable, Func<Exception, bool>?) for ongoing input and UI processing. It also does not change Current. Without Run(IRunnable, Func<Exception, bool>?), nothing drains work posted from other threads, so use Invoke(Action) to reach the UI thread.

Raises the IsRunningChanging, IsRunningChanged, and IsModalChanged events.