Пример #1
0
        /// <summary>
        /// Writes the input to the console control.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <param name="color">The color.</param>
        /// <param name="echo">if set to <c>true</c> echo the input.</param>
        public void WriteInput(string input, Color color, bool echo)
        {
            Invoke((Action)(() => {
                if (!this.IsHandleCreated || this.IsDisposed || this._isDisposed || string.IsNullOrWhiteSpace(input))
                {
                    return;
                }

                //  Are we echoing?
                if (echo)
                {
                    richTextBoxConsole.SelectionColor = color;
                    richTextBoxConsole.SelectedText += input;
                    InputStart = richTextBoxConsole.SelectionStart;
                }

                lastInput = input;

                //  Write the input.
                processInterace.WriteInput(input);

                //  Fire the event.
                FireConsoleInputEvent(input);
            }));
        }
Пример #2
0
 private void ExecuteCommand(string command)
 {
     Dispatcher.Invoke(() =>
     {
         _cmd.WriteInput(command);
         if (_history.Count > 14)
         {
             _history.RemoveAt(0);
         }
         if (_history.Contains(command))
         {
             _history.Remove(command);
         }
         _history.Add(command);
     });
 }
Пример #3
0
        /// <summary>
        ///     Writes the input to the console control.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <param name="color">The color.</param>
        /// <param name="echo">if set to <c>true</c> echo the input.</param>
        public void WriteInput(string input, Color color, bool echo)
        {
            Invoke((Action)(() =>
            {
                //  Are we echoing?
                if (echo)
                {
                    InternalRichTextBox.SelectionColor = color;
                    InternalRichTextBox.SelectedText += input;
                    _inputStart = InternalRichTextBox.SelectionStart;
                }

                _lastInput = input;

                //  Write the input.
                _processInteface.WriteInput(input);

                //  Fire the event.
                FireConsoleInputEvent(input);
            }));
        }
Пример #4
0
        /// <summary>
        ///     Writes the input to the console control.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <param name="color">The color.</param>
        /// <param name="echo">if set to <c>true</c> echo the input.</param>
        public void WriteInput(string input, Color color, bool echo)
        {
            processInterace.WriteInput(input);

            //Invoke((Action)(() =>
            //{
            //    //  Are we echoing?
            //    if (echo)
            //    {
            //        richTextBoxConsole.SelectionColor = color;
            //        richTextBoxConsole.SelectedText += input;
            //        inputStart = richTextBoxConsole.SelectionStart;
            //    }

            //    lastInput = input;

            //    //  Write the input.
            //    processInterace.WriteInput(input);

            //    //  Fire the event.
            //    FireConsoleInputEvent(input);
            //}));
        }