Exemplo n.º 1
0
            /// <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));
            }
Exemplo n.º 2
0
 public void PostInputLine(InputLine inputLine)
 {
     Debug.Assert(_dispatcher != null);
     if (_dispatcher != null)
     {
         _dispatcher.PostInputLine(inputLine);
     }
 }
Exemplo n.º 3
0
            public override void PostInputLine(InputLine inputLine)
            {
                // The editor should be completely readonly unless started.
                Debug.Assert(IsStarted);

                if (IsStarted)
                {
                    _buffer.Enqueue(inputLine);
                    ProcessInputs();
                }
            }
Exemplo n.º 4
0
 public override void PostInputLine(InputLine inputLine)
 {
     IsExecuting = true;
     try
     {
         if (Process(inputLine).Item1)
         {
             PromptNewLine();
         }
     }
     finally
     {
         IsExecuting = false;
     }
 }
Exemplo n.º 5
0
            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();
                        }
                    }
                }
            }
Exemplo n.º 6
0
 public abstract void PostInputLine(InputLine inputLine);