PSHostRawUserInterface Class

Definition

Defines the lowest-level user interface functions that an interactive application hosting PowerShell Runspace can choose to implement if it wants to support any cmdlet that does character-mode interaction with the user.

public ref class PSHostRawUserInterface abstract
public abstract class PSHostRawUserInterface
type PSHostRawUserInterface = class
Public MustInherit Class PSHostRawUserInterface
Inheritance
PSHostRawUserInterface

Remarks

It models an 2-dimensional grid of cells called a Buffer. A buffer has a visible rectangular region, called a window. Each cell of the grid has a character, a foreground color, and a background color. When the buffer has input focus, it shows a cursor positioned in one cell. Keystrokes can be read from the buffer and optionally echoed at the current cursor position.

Constructors

PSHostRawUserInterface()

Protected constructor which does nothing. Provided per .Net design guidelines section 4.3.1.

Properties

BackgroundColor

Gets or sets the color used to render the background behind characters on the screen buffer. Each character cell in the screen buffer can have a separate background color.

BufferSize

Gets or sets the current size of the screen buffer, measured in character cells.

CursorPosition

Gets or sets the cursor position in the screen buffer. The view window always adjusts it's location over the screen buffer such that the cursor is always visible.

CursorSize

Gets or sets the cursor size as a percentage 0..100.

ForegroundColor

Gets or sets the color used to render characters on the screen buffer. Each character cell in the screen buffer can have a separate foreground color.

KeyAvailable

A non-blocking call to examine if a keystroke is waiting in the input buffer.

MaxPhysicalWindowSize

Gets the largest window possible for the current font and display hardware, ignoring the current buffer dimensions. In other words, the dimensions of the largest window that could be rendered in the current display, if the buffer was at least as large.

MaxWindowSize

Gets the size of the largest window possible for the current buffer, current font, and current display hardware. The view window cannot be larger than the screen buffer or the current display (the display the window is rendered on).

WindowPosition

Gets or sets position of the view window relative to the screen buffer, in characters. (0,0) is the upper left of the screen buffer.

WindowSize

Gets or sets the current view window size, measured in character cells. The window size cannot be larger than the dimensions returned by MaxPhysicalWindowSize.

WindowTitle

Gets or sets the titlebar text of the current view window.

Methods

FlushInputBuffer()

Resets the keyboard input buffer.

GetBufferContents(Rectangle)

Extracts a rectangular region of the screen buffer.

LengthInBufferCells(Char)

Determines the number of BufferCells a character occupies.

LengthInBufferCells(String, Int32)

Determines the number of BufferCells a substring of a string occupies.

LengthInBufferCells(String)

Determines the number of BufferCells a string occupies.

NewBufferCellArray(Int32, Int32, BufferCell)

Creates a 2D array of BufferCells by examining contents.Character. PSHostRawUserInterface

NewBufferCellArray(Size, BufferCell)

Same as NewBufferCellArray(Int32, Int32, BufferCell)

NewBufferCellArray(String[], ConsoleColor, ConsoleColor)

Creates a two dimensional array of BufferCells by examining each character in contents.

ReadKey()

Reads a key stroke from the keyboard device, blocking until a keystroke is typed. Same as ReadKey(ReadKeyOptions.IncludeKeyDown)

ReadKey(ReadKeyOptions)

Reads a key stroke from the keyboard device, blocking until a keystroke is typed. Either one of ReadKeyOptions.IncludeKeyDown and ReadKeyOptions.IncludeKeyUp or both must be specified.

ScrollBufferContents(Rectangle, Coordinates, Rectangle, BufferCell)

Scroll a region of the screen buffer.

SetBufferContents(Coordinates, BufferCell[,])

Copies the BufferCell array into the screen buffer at the given origin, clipping such that cells in the array that would fall outside the screen buffer are ignored.

SetBufferContents(Rectangle, BufferCell)

Copies a given character to all of the character cells in the screen buffer with the indicated colors.

Applies to

See also