/// <summary> /// Reads a character from the console component /// </summary> /// <returns>The character read</returns> public char Read() { Reading = true; KeyMan.Focus(this); while (Reading) { ; //Wait for user to enter input } KeyMan.Unfocus(); return((char)In.Read()); }
/// <summary> /// Reads a segment/string from input /// </summary> /// <returns>The read string</returns> public string ReadLine() { Reading = true; KeyMan.Focus(this); while (Reading) { ; //Wait for user to enter input } KeyMan.Unfocus(); return(In.ReadLine()); }
public virtual void HandleCurrentInput(ConsoleKeyInfo Key) { if (Key.Key == ConsoleKey.Enter) { _inputActionCallBack(_sCurrentInput); KeyMan.Unfocus(); _sCurrentInput = ""; } else if (Key.Key == ConsoleKey.Backspace) { _sCurrentInput = _sCurrentInput.Remove(_sCurrentInput.Length - 1); } else { _sCurrentInput += Key.KeyChar; } Text = _sCurrentInput; }