Generated by DocFX

Class ConsoleImproved

This class implements improved handling for Console access including:

  • multiline input
  • hotkeys
Inheritance
System.Object
ConsoleImproved
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Dotnet.Shell.Logic.Console
Assembly: dotnet-shell-lib.dll
Syntax
public class ConsoleImproved

Constructors

| Improve this Doc View Source

ConsoleImproved(IConsole, Shell)

Initializes a new instance of the ConsoleImproved class.

Declaration
public ConsoleImproved(IConsole consoleImplementation, Shell shell)
Parameters
Type Name Description
IConsole consoleImplementation

The console implementation.

Shell shell

The shell.

Fields

| Improve this Doc View Source

Tag

An optional object to store state in

Declaration
public object Tag
Field Value
Type Description
System.Object

Properties

| Improve this Doc View Source

CursorPosition

Gets the cursor position.

Declaration
public int CursorPosition { get; }
Property Value
Type Description
System.Int32

The cursor position.

| Improve this Doc View Source

KeyOverrides

Gets the key overrides.

Declaration
public List<KeyValuePair<ConsoleKeyEx, Func<ConsoleImproved, ConsoleKeyEx, Task<bool>>>> KeyOverrides { get; }
Property Value
Type Description
System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<ConsoleKeyEx, System.Func<ConsoleImproved, ConsoleKeyEx, System.Threading.Tasks.Task<System.Boolean>>>>

The key overrides.

| Improve this Doc View Source

Shell

Gets the shell.

Declaration
public Shell Shell { get; }
Property Value
Type Description
Shell

The shell.

| Improve this Doc View Source

UserEnteredText

Gets or sets the user entered text.

Declaration
public string UserEnteredText { get; set; }
Property Value
Type Description
System.String

The user entered text.

| Improve this Doc View Source

UserEnteredTextPosition

Gets the user entered text position.

Declaration
public int UserEnteredTextPosition { get; }
Property Value
Type Description
System.Int32

The user entered text position.

| Improve this Doc View Source

Width

Gets the width of the screen

Declaration
public int Width { get; }
Property Value
Type Description
System.Int32

The width.

Methods

| Improve this Doc View Source

AddKeyOverride(ConsoleKeyEx, Func<ConsoleImproved, ConsoleKeyEx, Task<Boolean>>)

Adds a key override.

Declaration
public void AddKeyOverride(ConsoleKeyEx key, Func<ConsoleImproved, ConsoleKeyEx, Task<bool>> func)
Parameters
Type Name Description
ConsoleKeyEx key

The key.

System.Func<ConsoleImproved, ConsoleKeyEx, System.Threading.Tasks.Task<System.Boolean>> func

The function.

| Improve this Doc View Source

ClearUserEntry(Int32)

Clears the user text entry from the screen.

Declaration
public void ClearUserEntry(int numLinesToClear = -1)
Parameters
Type Name Description
System.Int32 numLinesToClear

The number lines to clear.

| Improve this Doc View Source

DisplayPrompt(Boolean)

Displays the prompt.

Declaration
public void DisplayPrompt(bool forcePromptOntoNewLine = true)
Parameters
Type Name Description
System.Boolean forcePromptOntoNewLine

if set to true [force prompt onto new line].

| Improve this Doc View Source

DisplayPrompt(String, Boolean)

Displays the prompt.

Declaration
public void DisplayPrompt(string text, bool forcePromptOntoNewLine)
Parameters
Type Name Description
System.String text

The text.

System.Boolean forcePromptOntoNewLine

if set to true [force prompt onto new line].

| Improve this Doc View Source

GetCommandAsync(CancellationToken)

Gets the command tryed in by the user asynchronously.

Declaration
public async Task<string> GetCommandAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.String>

Task

| Improve this Doc View Source

IgnoreTab()

Ignores the last tab character

Declaration
public void IgnoreTab()
| Improve this Doc View Source

ReplaceUserEntryAtPosition(String, Int32)

Replaces the user text at the specified position.

Declaration
public void ReplaceUserEntryAtPosition(string text, int position)
Parameters
Type Name Description
System.String text

The text.

System.Int32 position

The position.

| Improve this Doc View Source

Reset()

Resets this instance.

Declaration
public void Reset()
| Improve this Doc View Source

Write(ColorString)

Writes the specified text.

Declaration
public void Write(ColorString text)
Parameters
Type Name Description
ColorString text

The text.

| Improve this Doc View Source

Write(String, Boolean)

Writes the specified text.

Declaration
public void Write(string text = "", bool multiline = false)
Parameters
Type Name Description
System.String text

The text.

System.Boolean multiline

if set to true [multiline].

| Improve this Doc View Source

WriteLine(ColorString)

Writes the line.

Declaration
public void WriteLine(ColorString text)
Parameters
Type Name Description
ColorString text

The text.

| Improve this Doc View Source

WriteLine(String)

Writes the line.

Declaration
public void WriteLine(string message = "")
Parameters
Type Name Description
System.String message

The message.