Table of Contents

Method End

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

End(SessionToken)

Building block API: Ends the session associated with the token and completes the execution of an IRunnable. Not usually called directly by applications. Run(IRunnable, Func<Exception, bool>?) will automatically call this method when the session is stopped.

[Obsolete("The legacy static Application object is going away.")]
public static void End(SessionToken sessionToken)

Parameters

sessionToken SessionToken

The SessionToken returned by the Begin(IRunnable) method.

Remarks

This method removes the IRunnable from the SessionStack, raises the lifecycle events, and clears Runnable on sessionToken. A token ended beneath the top stays on the stack until the sessions above it end.

Raises IsRunningChanging, IsRunningChanged, and IsModalChanged events. While a call is ending the session, including while its IsRunningChanging handlers run, other calls for the same token return without effect. If stopping is canceled, a later call can end the session. A session is torn down only once. Once stopping proceeds, every remaining event, including SessionEnded, is raised even if a handler throws; the first exception is then rethrown.