C# Class PowerShellHtmlConsole.PSRemoteUserInterface

Inheritance: System.Management.Automation.Host.PSHostUserInterface
Afficher le fichier Open project: SzymonPobiega/PowerShellHtmlConsole Class Usage Examples

Méthodes publiques

Méthode Description
PSRemoteUserInterface ( InputOutputBuffers buffers ) : System
Prompt ( string caption, string message, Collection descriptions ) : PSObject>.Dictionary

Prompts the user for input.

PromptForChoice ( string caption, string message, Collection choices, int defaultChoice ) : int

Provides a set of choices that enable the user to choose a single option from a set of options.

PromptForCredential ( string caption, string message, string userName, string targetName ) : System.Management.Automation.PSCredential

Prompts the user for credentials with a specified prompt window caption, prompt message, user name, and target name.

PromptForCredential ( string caption, string message, string userName, string targetName, PSCredentialTypes allowedCredentialTypes, PSCredentialUIOptions options ) : System.Management.Automation.PSCredential

Prompts the user for credentials by using a specified prompt window caption, prompt message, user name and target name, credential types allowed to be returned, and UI behavior options.

ReadLine ( ) : string

Reads characters that are entered by the user until a newline (carriage return) is encountered.

ReadLineAsSecureString ( ) : SecureString

Reads characters entered by the user until a newline (carriage return) is encountered and returns the characters as a secure string.

Write ( ConsoleColor foregroundColor, ConsoleColor backgroundColor, string value ) : void

Writes characters to the output display of the host with possible foreground and background colors.

Write ( string value ) : void

Writes a line of characters to the output display of the host and appends a newline (carriage return).

WriteDebugLine ( string message ) : void

Writes a debug message to the output display of the host.

WriteErrorLine ( string value ) : void

Writes an error message to the output display of the host.

WriteLine ( ) : void

Writes a newline character (carriage return) to the output display of the host.

WriteLine ( ConsoleColor foregroundColor, ConsoleColor backgroundColor, string value ) : void

Writes a line of characters to the output display of the host with foreground and background colors and appends a newline (carriage return).

WriteLine ( string value ) : void

Writes a line of characters to the output display of the host and appends a newline character(carriage return).

WriteProgress ( long sourceId, System.Management.Automation.ProgressRecord record ) : void

Writes a progress report to the output display of the host. Wrinting a progress report is not required for the cmdlet to work so it is better to do nothing instead of throwing an exception.

WriteVerboseLine ( string message ) : void

Writes a verbose message to the output display of the host.

WriteWarningLine ( string message ) : void

Writes a warning message to the output display of the host.

Private Methods

Méthode Description
BuildHotkeysAndPlainLabels ( IEnumerable choices ) : string>>.IEnumerable

This is a private worker function splits out the accelerator keys from the menu and builds a two dimentional array with the first access containing the accelerator and the second containing the label string with the & removed.

FormatColor ( Color color ) : string
FormatWithColor ( string value, Color foregroundColorValue, Color backgroundColorValue ) : string
GetHotkeyAndLabel ( string input ) : string>.Tuple

Parse a string containing a hotkey character. Take a string of the form Yes to &all and returns a two-dimensional array split out as "A", "Yes to all".

MapColor ( ConsoleColor consoleColor ) : Color
ReadLineInternal ( bool secure, string overrideProppt = null ) : string

Method Details

PSRemoteUserInterface() public méthode

public PSRemoteUserInterface ( InputOutputBuffers buffers ) : System
buffers InputOutputBuffers
Résultat System

Prompt() public méthode

Prompts the user for input.
public Prompt ( string caption, string message, Collection descriptions ) : PSObject>.Dictionary
caption string Text that preceeds the prompt (a title).
message string Text of the prompt.
descriptions Collection A collection of FieldDescription objects /// that contains the user input.
Résultat PSObject>.Dictionary

PromptForChoice() public méthode

Provides a set of choices that enable the user to choose a single option from a set of options.
public PromptForChoice ( string caption, string message, Collection choices, int defaultChoice ) : int
caption string A title that proceeds the choices.
message string An introduction message that describes the /// choices.
choices Collection A collection of ChoiceDescription objects that describ /// each choice.
defaultChoice int The index of the label in the Choices parameter /// collection that indicates the default choice used if the user does not specify /// a choice. To indicate no default choice, set to -1.
Résultat int

PromptForCredential() public méthode

Prompts the user for credentials with a specified prompt window caption, prompt message, user name, and target name.
public PromptForCredential ( string caption, string message, string userName, string targetName ) : System.Management.Automation.PSCredential
caption string The caption of the message window.
message string The text of the message.
userName string The user name whose credential is to be prompted for.
targetName string The name of the target for which the credential is collected.
Résultat System.Management.Automation.PSCredential

PromptForCredential() public méthode

Prompts the user for credentials by using a specified prompt window caption, prompt message, user name and target name, credential types allowed to be returned, and UI behavior options.
public PromptForCredential ( string caption, string message, string userName, string targetName, PSCredentialTypes allowedCredentialTypes, PSCredentialUIOptions options ) : System.Management.Automation.PSCredential
caption string The caption of the message window.
message string The text of the message.
userName string The user name whose credential is to be prompted for.
targetName string The name of the target for which the credential is collected.
allowedCredentialTypes PSCredentialTypes PSCredentialTypes cconstants that identify the type of /// credentials that can be returned.
options PSCredentialUIOptions A PSCredentialUIOptions constant that identifies the UI behavior /// when it gathers the credentials.
Résultat System.Management.Automation.PSCredential

ReadLine() public méthode

Reads characters that are entered by the user until a newline (carriage return) is encountered.
public ReadLine ( ) : string
Résultat string

ReadLineAsSecureString() public méthode

Reads characters entered by the user until a newline (carriage return) is encountered and returns the characters as a secure string.
public ReadLineAsSecureString ( ) : SecureString
Résultat System.Security.SecureString

Write() public méthode

Writes characters to the output display of the host with possible foreground and background colors.
public Write ( ConsoleColor foregroundColor, ConsoleColor backgroundColor, string value ) : void
foregroundColor ConsoleColor The color of the characters.
backgroundColor ConsoleColor The backgound color to use.
value string The characters to be written.
Résultat void

Write() public méthode

Writes a line of characters to the output display of the host and appends a newline (carriage return).
public Write ( string value ) : void
value string The characters to be written.
Résultat void

WriteDebugLine() public méthode

Writes a debug message to the output display of the host.
public WriteDebugLine ( string message ) : void
message string The debug message that is displayed.
Résultat void

WriteErrorLine() public méthode

Writes an error message to the output display of the host.
public WriteErrorLine ( string value ) : void
value string The error message that is displayed.
Résultat void

WriteLine() public méthode

Writes a newline character (carriage return) to the output display of the host.
public WriteLine ( ) : void
Résultat void

WriteLine() public méthode

Writes a line of characters to the output display of the host with foreground and background colors and appends a newline (carriage return).
public WriteLine ( ConsoleColor foregroundColor, ConsoleColor backgroundColor, string value ) : void
foregroundColor ConsoleColor The forground color of the display.
backgroundColor ConsoleColor The background color of the display.
value string The line to be written.
Résultat void

WriteLine() public méthode

Writes a line of characters to the output display of the host and appends a newline character(carriage return).
public WriteLine ( string value ) : void
value string The line to be written.
Résultat void

WriteProgress() public méthode

Writes a progress report to the output display of the host. Wrinting a progress report is not required for the cmdlet to work so it is better to do nothing instead of throwing an exception.
public WriteProgress ( long sourceId, System.Management.Automation.ProgressRecord record ) : void
sourceId long Unique identifier of the source of the record.
record System.Management.Automation.ProgressRecord A ProgressReport object.
Résultat void

WriteVerboseLine() public méthode

Writes a verbose message to the output display of the host.
public WriteVerboseLine ( string message ) : void
message string The verbose message that is displayed.
Résultat void

WriteWarningLine() public méthode

Writes a warning message to the output display of the host.
public WriteWarningLine ( string message ) : void
message string The warning message that is displayed.
Résultat void