API Reference
WindowsConsoleInput
Reads the Windows console input buffer with ReadConsoleInputW: every key with its modifiers (Ctrl and Alt combinations, Shift+Tab, function keys), Alt+numpad characters, AltGr characters, pastes (a burst of characters in one read), window resizes and focus changes. While it is open, line input, echo and Ctrl+C processing are off, so Ctrl+C arrives as a key; the original console mode is restored on disposal.
Inheritance
- Object
- WindowsConsoleInput
Usage
Explore 1 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 1
- Method WindowsConsoleInput.TryOpen
Methods
public Void Dispose() #VoidPerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public InputEvent? Read(TimeSpan timeout, CancellationToken cancellationToken) #InputEvent?Waits up to timeout for the next event.
Parameters
- timeout System.TimeSpan
- The longest wait; TimeSpan.Zero polls.
- cancellationToken System.Threading.CancellationToken
- Cancels the wait with OperationCanceledException.
Returns
The event, or null when the timeout passed without input.
Exceptions
InputClosedException– The input ended (end of a script, closed stdin).
public Void Resume() #VoidSwitches back to raw key input after WindowsConsoleInput.Suspend, discarding keys typed meanwhile.
public Void Suspend() #VoidGives the console back its normal input mode for a while (a live dashboard run, where Ctrl+C must reach the session as a signal); WindowsConsoleInput.Resume switches back and drops keys typed meanwhile.
public static WindowsConsoleInput? TryOpen() #WindowsConsoleInput?Opens the console input when standard input is a console; returns null otherwise (redirected, no console).
Returns
The source, or null.
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public String Name { get; } #A short description for diagnostics, for example windows console (ReadConsoleInputW).