Table of Contents

Method Run

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Run(Func<Exception, bool>)

Runs the application by calling Run(Toplevel, Func<Exception, bool>) with the value of Top.

public static void Run(Func<Exception, bool> errorHandler = null)

Parameters

errorHandler Func<Exception, bool>

Remarks

Run<T>(Func<Exception, bool>, ConsoleDriver, IMainLoopDriver)

Runs the application by calling Run(Toplevel, Func<Exception, bool>) with a new instance of the specified Toplevel-derived class.

Calling Init(ConsoleDriver, IMainLoopDriver) first is not needed as this function will initialze the application.

Shutdown() must be called when the application is closing (typically after Run> has returned) to ensure resources are cleaned up and terminal settings restored.

public static void Run<T>(Func<Exception, bool> errorHandler = null, ConsoleDriver driver = null, IMainLoopDriver mainLoopDriver = null) where T : Toplevel, new()

Parameters

errorHandler Func<Exception, bool>
driver ConsoleDriver

The ConsoleDriver to use. If not specified the default driver for the platform will be used (WindowsDriver, CursesDriver, or NetDriver). This parameteter must be null if Init(ConsoleDriver, IMainLoopDriver) has already been called.

mainLoopDriver IMainLoopDriver

Specifies the MainLoop to use.

Type Parameters

T

Remarks

Run(Toplevel, Func<Exception, bool>)

Runs the main loop on the given Toplevel container.

public static void Run(Toplevel view, Func<Exception, bool> errorHandler = null)

Parameters

view Toplevel

The Toplevel to run modally.

errorHandler Func<Exception, bool>

RELEASE builds only: Handler for any unhandled exceptions (resumes when returns true, rethrows when null).

Remarks

This method is used to start processing events for the main application, but it is also used to run other modal Views such as Dialog boxes.

To make a Run(Toplevel, Func<Exception, bool>) stop execution, call RequestStop(Toplevel).

Calling Run(Toplevel, Func<Exception, bool>) is equivalent to calling Begin(Toplevel), followed by RunLoop(RunState, bool), and then calling End(RunState).

Alternatively, to have a program control the main loop and process events manually, call Begin(Toplevel) to set things up manually and then repeatedly call RunLoop(RunState, bool) with the wait parameter set to false. By doing this the RunLoop(RunState, bool) method will only process any pending events, timers, idle handlers and then return control immediately.

RELEASE builds only: When errorHandler is null any exeptions will be rethrown. Otheriwse, if errorHandler will be called. If errorHandler returns true the RunLoop(RunState, bool) will resume; otherwise this method will exit.