Exemple #1
0
        /// <summary>
        /// Task.cs \\ Append to Console
        /// </summary>
        public void WriteConsole(string s)
        {
            if (s == null)
            {
                return;
            }

            long ticks   = DateTime.Now.Ticks;
            bool doFocus = ticks - consoleTicksWhenLastFocus > 10000000L;

            if (doFocus)
            {
                consoleTicksWhenLastFocus = ticks;
            }

            ConsoleBox2.Dispatcher.Invoke(new Action(() =>
            {
                if (stringErrorArray.Any(s.Contains))
                {
                    AppendColoredText(s, "Red");
                }

                else if (stringWarningArray.Any(s.Contains))
                {
                    if (s.Contains(":INFO: "))
                    {
                        s = s.Replace(":INFO: ", "");
                    }

                    AppendColoredText(s, "#FFDE8300"); //"Yellow");
                }

                else if (stringGreenArray.Any(s.Contains))
                {
                    if (s.Contains(":GREEN: "))
                    {
                        s = s.Replace(":GREEN: ", "");
                    }

                    AppendColoredText(s, "Green");
                }

                else if (stringStatusArray.Any(s.Contains))
                {
                    s = s.Replace("CONSOLESTATUS:", "");
                    label_cmpStatus.Content = s;
                    s = "";
                }

                else
                {
                    AppendColoredText(s, "WhiteSmoke");
                }

                ConsoleBox2.ScrollToEnd();
            }));
        }
Exemple #2
0
        /// <summary>
        /// Task.cs \\ Clear Console
        /// </summary>
        public void ClearConsole()
        {
            splash = false;

            ConsoleBox2.Document.FontSize      = 11;
            ConsoleBox2.Document.TextAlignment = TextAlignment.Left;

            ConsoleBox2.SelectAll();
            ConsoleBox2.Selection.Text = "";
        }