/// <summary> /// Process a input line. /// </summary> /// <param name="inputLine"></param> protected Tuple <bool, bool> Process(InputLine inputLine) { SnapshotSpan inputSpan = inputLine.SnapshotSpan; if (inputLine.Flags.HasFlag(InputLineFlag.Echo)) { WpfConsole.BeginInputLine(); if (inputLine.Flags.HasFlag(InputLineFlag.Execute)) { WpfConsole.WriteLine(inputLine.Text); inputSpan = WpfConsole.EndInputLine(true).Value; } else { WpfConsole.Write(inputLine.Text); } } if (inputLine.Flags.HasFlag(InputLineFlag.Execute)) { string command = inputLine.Text; bool isExecuted = WpfConsole.Host.Execute(WpfConsole, command, null); WpfConsole.InputHistory.Add(command); ParentDispatcher.OnExecute(inputSpan, isExecuted); return(Tuple.Create(true, isExecuted)); } return(Tuple.Create(false, false)); }
public void PostInputLine(InputLine inputLine) { Debug.Assert(_dispatcher != null); if (_dispatcher != null) { _dispatcher.PostInputLine(inputLine); } }
public override void PostInputLine(InputLine inputLine) { // The editor should be completely readonly unless started. Debug.Assert(IsStarted); if (IsStarted) { _buffer.Enqueue(inputLine); ProcessInputs(); } }
public override void PostInputLine(InputLine inputLine) { IsExecuting = true; try { if (Process(inputLine).Item1) { PromptNewLine(); } } finally { IsExecuting = false; } }
private void ProcessInputs() { if (IsExecuting) { return; } if (_buffer.Count > 0) { InputLine inputLine = _buffer.Dequeue(); Tuple <bool, bool> executeState = Process(inputLine); if (executeState.Item1) { IsExecuting = true; if (!executeState.Item2) { // If NOT really executed, processing the same as ExecuteEnd event OnExecuteEnd(); } } } }
public abstract void PostInputLine(InputLine inputLine);