Class NullScreen
Implements
Inherited Members
Namespace: SociallyDistant.Core.OS.Devices
Assembly: SociallyDistant.Framework.dll
Syntax
public sealed class NullScreen : ITextScreen
Properties
Columns
Gets the width of the screen, in characters.
Declaration
public int Columns { get; }
Property Value
Type | Description |
---|---|
int |
CursorLeft
Gets the horizontal position of the cursor, in characters.
Declaration
public int CursorLeft { get; }
Property Value
Type | Description |
---|---|
int |
CursorTop
Gets the vertical position of the cursor, in characters.
Declaration
public int CursorTop { get; }
Property Value
Type | Description |
---|---|
int |
Rows
Gets the height of the screen, in characters.
Declaration
public int Rows { get; }
Property Value
Type | Description |
---|---|
int |
Title
Gets or sets the title of this text screen. Implementations or users of ITextScreen can display this text in other UI elements, such as a tab.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
ClearScreen()
Clear the screen.
Declaration
public void ClearScreen()
Fill(Rune, int, int, int, int)
Fill a rectangular region of the screen with a specified Rune value.
Declaration
public void Fill(Rune rune, int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Rune | rune | The character to fill the rectangle with. |
int | x | The left column of the rectangle. |
int | y | The top row of the rectangle. |
int | width | The width, in columns, of the rectangle. |
int | height | The height, in rows, of the rectangle. |
Print(in ReadOnlySpan<Rune>)
Print the specified set of Rune values to the screen.
Declaration
public void Print(in ReadOnlySpan<Rune> unicodeRunes)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<Rune> | unicodeRunes | A set of Unicode characters to write. |
Print(string)
Print the specified text to the screen.
Declaration
public void Print(string text)
Parameters
Type | Name | Description |
---|---|---|
string | text | A string of text to write. |
ReadLine(IHistoryCollection?, CancellationToken?)
Prompts the user to enter a line of text into the screen, creating a task that resolves with the entered text.
Declaration
public Task<string?> ReadLine(IHistoryCollection? historyCollection = null, CancellationToken? cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IHistoryCollection | historyCollection | An optional IHistoryCollection containing command-line history, if applicable. |
CancellationToken? | cancellationToken | A cancellation token for interrupting the prompt. |
Returns
Type | Description |
---|---|
Task<string> | A task that resolves with the entered text. If a null string is returned, the screen doesn't support keyboard input. |
ResetBackgroundColor()
Reset the cursor's background color to its default.
Declaration
public void ResetBackgroundColor()
ResetCursorPosition()
Move the cursor to the top-left.
Declaration
public void ResetCursorPosition()
ResetFont()
Reset the cursor's font style to its default.
Declaration
public void ResetFont()
ResetForegroundColor()
Reset the cursor's foreground color to its default.
Declaration
public void ResetForegroundColor()
ResetTextEffects()
Reset the cursor's text effects to the default.
Declaration
public void ResetTextEffects()
SetBackgroundColor(Color)
Declaration
public void SetBackgroundColor(Color newBackgroundColor)
Parameters
Type | Name | Description |
---|---|---|
Color | newBackgroundColor |
SetBackgroundColor(byte, byte, byte)
Set the background color of the cursor to the specified true color.
Declaration
public void SetBackgroundColor(byte red, byte green, byte blue)
Parameters
Type | Name | Description |
---|---|---|
byte | red | Value for the red channel. |
byte | green | Value for the green channel. |
byte | blue | Value for the blue channel. |
SetBackgroundColor(ConsoleColor)
Set the background color of the cursor to the specified ConsoleColor value.
Declaration
public void SetBackgroundColor(ConsoleColor paletteColor)
Parameters
Type | Name | Description |
---|---|---|
ConsoleColor | paletteColor | One of the 16 colors available in the ConsoleColor palette. |
SetCursorPosition(int, int)
Move the cursor to a new position.
Declaration
public void SetCursorPosition(int left, int top)
Parameters
Type | Name | Description |
---|---|---|
int | left | The new column for the cursor. |
int | top | The new row for the cursor. |
SetFont(bool, bool)
Change the cursor's font style.
Declaration
public void SetFont(bool bold, bool italic)
Parameters
Type | Name | Description |
---|---|---|
bool | bold | Value indicating whether text should be bold. |
bool | italic | Value indicating whether text should be italic. |
SetForegroundColor(Color)
Declaration
public void SetForegroundColor(Color newBackgroundColor)
Parameters
Type | Name | Description |
---|---|---|
Color | newBackgroundColor |
SetForegroundColor(byte, byte, byte)
Set the foreground color of the cursor to the specified true color.
Declaration
public void SetForegroundColor(byte red, byte green, byte blue)
Parameters
Type | Name | Description |
---|---|---|
byte | red | Value for the red channel. |
byte | green | Value for the green channel. |
byte | blue | Value for the blue channel. |
SetForegroundColor(ConsoleColor)
Set the foreground color of the cursor to the specified ConsoleColor value.
Declaration
public void SetForegroundColor(ConsoleColor paletteColor)
Parameters
Type | Name | Description |
---|---|---|
ConsoleColor | paletteColor | One of the 16 colors available in the ConsoleColor palette. |
SetTextEffects(bool, bool)
Change the cursor's text effects.
Declaration
public void SetTextEffects(bool underline, bool strikeThrough)
Parameters
Type | Name | Description |
---|---|---|
bool | underline | Value indicating whether text should be underlined. |
bool | strikeThrough | Value indicating whether text should be stricken out. |
WaitForKey(CancellationToken?)
Creates an awaitable task that resolves when a key is pressed.
Declaration
public Task<ConsoleInputData?> WaitForKey(CancellationToken? cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken? | cancellationToken | A cancellation token for cancelling the task. |
Returns
Type | Description |
---|---|
Task<ConsoleInputData?> | A Task<TResult> that resolves when a key is pressed inside this screen. A null value returned at task completion means that this screen doessn't support input. |
Write(Rune)
Write the specified Rune value to the screen, and advance the cursor by one cell.
Declaration
public void Write(Rune rune)
Parameters
Type | Name | Description |
---|---|---|
Rune | rune | The Unicode character to write to the screen. |