private void Prompt() { Write(PromptText); _editableStartPosition = _consoleEditor.Model.TextLength; _userInput = null; _parsedUserInput = null; _isPromptMode = true; }
private void ConsoleEditorModified(object sender, ModifiedEventArgs e) { //Блокиробка перед попыткой ввода в область вывода. if (e.Position < _editableStartPosition && ((e.ModificationTypes & (ModificationTypes.BeforeInsert | ModificationTypes.BeforeDelete)) != 0)) { _consoleEditor.ReadOnly = true; SystemSounds.Beep.Play(); } //Обработка после произведения блокировки. else if (_consoleEditor.ReadOnly) { _consoleEditor.ReadOnly = false; _consoleEditor.CaretPosition = _consoleEditor.Model.TextLength; _consoleEditor.ScrollToCaret(); } //Парсинг ввода. else if (_isPromptMode) { _userInput = _consoleEditor.Model.GetTextRange( _editableStartPosition, _consoleEditor.Model.TextLength); _parsedUserInput = ConsoleParser.Parse(_userInput); } }