Example #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));
            }
Example #2
0
 private void WriteError(string message)
 {
     if (WpfConsole != null)
     {
         WpfConsole.Write(message + Environment.NewLine, Colors.Red, null);
     }
 }
Example #3
0
 protected void PromptNewLine()
 {
     WpfConsole.Write(WpfConsole.Host.Prompt + (char)32); // 32 is the space
     WpfConsole.BeginInputLine();
 }