C# Class PoshCode.PoshConsole

Inheritance: PoshCode.Controls.ConsoleControl, IRichConsole
Datei anzeigen Open project: Jaykul/PoshConsole

Public Properties

Property Type Description
ContentProperty System.Windows.DependencyProperty
ProgressProperty System.Windows.DependencyProperty

Private Properties

Property Type Description
BuildHotkeysAndPlainLabels ].string[
GetHotkeyAndLabel string[]
GetSingle System.Management.Automation.PSObject
TryConvertTo System.Management.Automation.PSInvalidCastException

Public Methods

Method Description
Invoke ( string script, ConsoleOutput output = ConsoleOutput.Default ) : Collection

Invoke the specified script, synchronously, and return the pipeline output.

InvokeAsync ( Command commands, IEnumerable input = null, ConsoleOutput output = ConsoleOutput.Default ) : Task

Invoke the specified commands in a pipeline asynchronously, optionally providing input to the first command, and with the specified output handling.

InvokeAsync ( string command, bool isScript = true, bool useLocalScope = false, IEnumerable input = null, ConsoleOutput output = ConsoleOutput.Default ) : Task

Invoke the specified command in a pipeline asynchronously, optionally providing input to the first command, and with the specified output handling.

OnPromptForChoice ( PromptForChoiceEventArgs e ) : int
OnPromptForObject ( PromptForObjectEventArgs e ) : PSObject>.Dictionary
PoshConsole ( ) : System
PromptForCredentialInline ( string caption, string message, string userName, string targetName, PSCredentialTypes allowedCredentialTypes = PSCredentialTypes.Generic, PSCredentialUIOptions options = PSCredentialUIOptions.None ) : System.Management.Automation.PSCredential
WriteErrorRecord ( ErrorRecord errorRecord ) : void
WriteErrorRecords ( Collection errorRecords ) : void

Protected Methods

Method Description
Dispose ( bool disposing ) : void
OnCommand ( CommandEventArgs command ) : void
OnInitialized ( EventArgs e ) : void

Private Methods

Method Description
BuildHotkeysAndPlainLabels ( Collection choices, bool addHelp ) : ].string[

This is a private worker function that 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 & removed.

GetHotkeyAndLabel ( string input ) : string[]

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

GetSingle ( string caption, string message, string prompt, System.Management.Automation.Host.FieldDescription field, Type type ) : System.Management.Automation.PSObject
TryConvertTo ( Type type, string input, object &output ) : System.Management.Automation.PSInvalidCastException

Method Details

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

Invoke() public method

Invoke the specified script, synchronously, and return the pipeline output.
public Invoke ( string script, ConsoleOutput output = ConsoleOutput.Default ) : Collection
script string The script from which the pipeline will be constructed. Can be just a command name, but is executed as though typed on the console.
output ConsoleOutput Optionally: what to print to the console (prints everything, by default, as though the user had typed the commands in the console)
return Collection

InvokeAsync() public method

Invoke the specified commands in a pipeline asynchronously, optionally providing input to the first command, and with the specified output handling.
public InvokeAsync ( Command commands, IEnumerable input = null, ConsoleOutput output = ConsoleOutput.Default ) : Task
commands Command Commands from which the pipeline will be constructed
input IEnumerable Optional Pipeline Input. If this is specified, your first command must accept pipeline input
output ConsoleOutput Optionally: what to print to the console (prints everything, by default, as though the user had typed the commands in the console)
return Task

InvokeAsync() public method

Invoke the specified command in a pipeline asynchronously, optionally providing input to the first command, and with the specified output handling.
public InvokeAsync ( string command, bool isScript = true, bool useLocalScope = false, IEnumerable input = null, ConsoleOutput output = ConsoleOutput.Default ) : Task
command string The Command from which the pipeline will be constructed.
isScript bool Whether the command is a script (defaults to true). You should set this to false if you are just naming a command.
useLocalScope bool Whether the command should use it's own local scope -- only valid for scripts (defaults to false)
input IEnumerable Optional Pipeline Input. If this is specified, your first command must accept pipeline input
output ConsoleOutput Optionally: what to print to the console (prints everything, by default, as though the user had typed the commands in the console)
return Task

OnCommand() protected method

protected OnCommand ( CommandEventArgs command ) : void
command PoshCode.Controls.CommandEventArgs
return void

OnInitialized() protected method

protected OnInitialized ( EventArgs e ) : void
e System.EventArgs
return void

OnPromptForChoice() public method

public OnPromptForChoice ( PromptForChoiceEventArgs e ) : int
e PoshCode.Controls.PromptForChoiceEventArgs
return int

OnPromptForObject() public method

public OnPromptForObject ( PromptForObjectEventArgs e ) : PSObject>.Dictionary
e PoshCode.Controls.PromptForObjectEventArgs
return PSObject>.Dictionary

PoshConsole() public method

public PoshConsole ( ) : System
return System

PromptForCredentialInline() public method

public PromptForCredentialInline ( string caption, string message, string userName, string targetName, PSCredentialTypes allowedCredentialTypes = PSCredentialTypes.Generic, PSCredentialUIOptions options = PSCredentialUIOptions.None ) : System.Management.Automation.PSCredential
caption string
message string
userName string
targetName string
allowedCredentialTypes PSCredentialTypes
options PSCredentialUIOptions
return System.Management.Automation.PSCredential

WriteErrorRecord() public method

public WriteErrorRecord ( ErrorRecord errorRecord ) : void
errorRecord System.Management.Automation.ErrorRecord
return void

WriteErrorRecords() public method

public WriteErrorRecords ( Collection errorRecords ) : void
errorRecords Collection
return void

Property Details

ContentProperty public_oe static_oe property

public static DependencyProperty,System.Windows ContentProperty
return System.Windows.DependencyProperty

ProgressProperty public_oe static_oe property

public static DependencyProperty,System.Windows ProgressProperty
return System.Windows.DependencyProperty