public override void Write(string value) { if (externalUI != null) { externalUI.Write(value); } if (!paused) { writeCache.Append(value); } }
public override void Write(string value) { if (externalUI == null) { throw new InvalidOperationException(); } externalUI.Write(value); if (!paused) { writeCache.Append(value); } }
internal PromptResponse PromptUser(PSHostUserInterface console) { char ch = char.MinValue; for (int i = 0; i < this.actualPrompt.Count; i++) { if (i < (this.actualPrompt.Count - 1)) { console.WriteLine(this.actualPrompt[i]); } else { console.Write(this.actualPrompt[i]); } } do { this.callingCmdlet.CheckStopProcessing(); switch (console.RawUI.ReadKey(ReadKeyOptions.IncludeKeyUp | ReadKeyOptions.NoEcho).Character) { case 'q': case 'Q': console.WriteLine(); return(PromptResponse.Quit); case ' ': console.WriteLine(); return(PromptResponse.NextPage); } }while (ch != '\r'); console.WriteLine(); return(PromptResponse.NextLine); }
internal static SecureString PromptForSecureString(PSHostUserInterface hostUI, string prompt) { hostUI.Write(prompt); SecureString secureString = hostUI.ReadLineAsSecureString(); hostUI.WriteLine(""); return(secureString); }
private void ShowHelp(PSHostUserInterface hostUI, string?helpText) { if (helpText is null) { return; } if (_showHelp) { hostUI.WriteLine(); hostUI.Write(helpText); if (_showExtendedHelp) { hostUI.Write(ManagedEntranceStrings.ExtendedHelp); } hostUI.WriteLine(); } }
/// <summary> /// present a prompt for a SecureString data /// </summary> /// /// <param name="hostUI"> ref to host ui interface </param> /// /// <param name="prompt"> prompt text </param> /// /// <returns> user input as secure string </returns> /// /// <remarks> </remarks> /// internal static SecureString PromptForSecureString(PSHostUserInterface hostUI, string prompt) { SecureString ss = null; hostUI.Write(prompt); ss = hostUI.ReadLineAsSecureString(); hostUI.WriteLine(string.Empty); return(ss); }
public override void Write(string value) { if (_threadHostUserInterface == null) { _originalWriter.Write(value); } else { _threadHostUserInterface.Write(value); } }
/// <summary> /// Do the actual prompting. /// </summary> /// <param name="console">PSHostUserInterface instance to prompt to.</param> internal PromptResponse PromptUser(PSHostUserInterface console) { // NOTE: assume the values passed to ComputePromptLines are still valid // write out the prompt line(s). The last one will not have a new line // at the end because we leave the prompt at the end of the line for (int k = 0; k < _actualPrompt.Count; k++) { if (k < (_actualPrompt.Count - 1)) { console.WriteLine(_actualPrompt[k]); // intermediate line(s) } else { console.Write(_actualPrompt[k]); // last line } } while (true) { _callingCmdlet.CheckStopProcessing(); KeyInfo ki = console.RawUI.ReadKey(ReadKeyOptions.IncludeKeyUp | ReadKeyOptions.NoEcho); char key = ki.Character; if (key == 'q' || key == 'Q') { // need to move to the next line since we accepted input, add a newline console.WriteLine(); return(PromptResponse.Quit); } else if (key == ' ') { // need to move to the next line since we accepted input, add a newline console.WriteLine(); return(PromptResponse.NextPage); } else if (key == '\r') { // need to move to the next line since we accepted input, add a newline console.WriteLine(); return(PromptResponse.NextLine); } } }
public override void Write(string value) { _ui.Write(value); }