Skip to main content

Screen class

Namespace: Arlecchino · Assembly: Arlecchino

Draws the frames: the current view first, inside the IArlecchinoLayout when there is one, then the output line, the keys and any dialog on top. A view that throws is reported on the output line rather than taking the application down.

public class Screen

Methods

MemberSummary
DrawOnce()Draws one full frame, forgetting what the screen held first. Redrawing everything is what makes this usable outside the loop — in tests, or after something else has written to the terminal.
RedrawEverything()Asks for the next frame to be drawn from scratch rather than as a difference. Safe from any thread, and needed whenever something outside the framework has written over the screen — coming back from a suspended process, for one.
Run(CancellationToken)Draws until stopped, at the configured rate. A frame is only built when something asked for one or the terminal changed size, so an idle application costs nothing.

Methods in detail

DrawOnce()

public void DrawOnce();

Draws one full frame, forgetting what the screen held first. Redrawing everything is what makes this usable outside the loop — in tests, or after something else has written to the terminal.

RedrawEverything()

public void RedrawEverything();

Asks for the next frame to be drawn from scratch rather than as a difference. Safe from any thread, and needed whenever something outside the framework has written over the screen — coming back from a suspended process, for one.

Run(CancellationToken)

public Task Run(CancellationToken stoppingToken);

Draws until stopped, at the configured rate. A frame is only built when something asked for one or the terminal changed size, so an idle application costs nothing.

Parameters

NameTypeDescription
stoppingTokenCancellationTokenCanceled when the application is shutting down.

Returns Task — A task that completes once drawing has stopped.