protected Tuple <bool, bool> Process(InputLine inputLine) { if (inputLine.Flags.HasFlag(InputLineFlag.Echo)) { WpfConsole.BeginInputLine(); if (inputLine.Flags.HasFlag(InputLineFlag.Execute)) { WpfConsole.WriteLine(inputLine.Text); } else { WpfConsole.Write(inputLine.Text); } } if (inputLine.Flags.HasFlag(InputLineFlag.Execute)) { string command = inputLine.Text; bool isExecuted = WpfConsole.Host.Execute(WpfConsole, command); WpfConsole.InputHistory.Add(command); return(Tuple.Create(true, isExecuted)); } return(Tuple.Create(false, false)); }
private void StartConsoleSession(FrameworkElement consolePane) { if (WpfConsole != null && WpfConsole.Content == consolePane && WpfConsole.Host != null) { try { if (WpfConsole.Dispatcher.IsStartCompleted) { OnDispatcherStartCompleted(); } else { WpfConsole.Dispatcher.StartCompleted += (sender, args) => OnDispatcherStartCompleted(); WpfConsole.Dispatcher.Start(); } } catch (Exception x) { // hide the text "initialize host" when an error occurs. ConsoleParentPane.NotifyInitializationCompleted(); WpfConsole.WriteLine(x.ToString()); } } }