Exemplo n.º 1
0
        /// <summary>
        /// Appends text to the console output.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="type">The text type.</param>
        void AppendToConsole(string text, ConsoleTextType type)
        {
            Color color;

            switch (type)
            {
            case ConsoleTextType.InputReturn:
                color = Color.Black;
                break;

            case ConsoleTextType.Info:
                color = Color.Blue;
                break;

            default:
                color = Color.Green;
                break;
            }

            lock (_consoleOutLock)
            {
                txtConsoleOut.ForeColor = color;
                txtConsoleOut.AppendText(text + Environment.NewLine);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Appends text to the console output.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="type">The text type.</param>
        void AppendToConsole(string text, ConsoleTextType type)
        {
            Color color;

            switch (type)
            {
                case ConsoleTextType.InputReturn:
                    color = Color.Black;
                    break;

                case ConsoleTextType.Info:
                    color = Color.Blue;
                    break;

                default:
                    color = Color.Green;
                    break;
            }

            lock (_consoleOutLock)
            {
                txtConsoleOut.ForeColor = color;
                txtConsoleOut.AppendText(text + Environment.NewLine);
            }
        }
Exemplo n.º 3
0
        private Color GetColor(ConsoleTextType textType)
        {
            switch (textType)
            {
            case ConsoleTextType.Warning:
                return(ConsoleWarningColor);

            case ConsoleTextType.Error:
                return(ConsoleErrorColor);

            case ConsoleTextType.Information:
                return(ConsoleInformationColor);

            default:
                return(ConsoleResultColor);
            }
        }
Exemplo n.º 4
0
        public void WriteConsole(string text, ConsoleTextType textType = ConsoleTextType.Output, string separator = ">")
        {
            ShowBottomPaneRow();

            BottomTabs.SelectedItem = ConsoleTab;

            var doc         = ConsoleText.Document;
            var startOffset = doc.TextLength;

            doc.Insert(doc.TextLength, $"{DateTime.Now:dd/MM/yyyy HH:mm:ss.fff} {separator} {text}{Environment.NewLine}");
            var endOffset = doc.TextLength;

            var colorizer = new OffsetColorizer(GetColor(textType))
            {
                StartOffset = startOffset, EndOffset = endOffset
            };

            ConsoleText.TextArea.TextView.LineTransformers.Add(colorizer);

            ConsoleText.ScrollToEnd();
        }