Exemplo n.º 1
0
 /// <summary>
 /// Writes text to the section.
 /// </summary>
 /// <param name="msg">Message to write.</param>
 /// <param name="args">Arguments for the formatted string.</param>
 public void Write(string msg, params object[] args)
 {
     if (!DashCMD.ConsoleHandleExists)
     {
         return;
     }
     Console.BackgroundColor = BackgroundColor;
     Console.ForegroundColor = ForegroundColor;
     DashCMD.stdWrite(String.Format(msg, args));
 }
Exemplo n.º 2
0
        void Loop()
        {
            string txt       = String.Format("Screen - {0}", Name);
            string spaces    = new string(' ', (Console.BufferWidth / 2) - (txt.Length / 2));
            string titleLine = "(Esc to exit)".PadLeft(Console.BufferWidth);
            string title     = String.Format("{0}{1}{2}{3}{4}",
                                             spaces, txt, spaces.Substring(0, spaces.Length - 1), Environment.NewLine, titleLine);
            bool firstStep = true;

            if (AutoUpdate)
            {
                do
                {
                    int top = Console.WindowTop;
                    Console.BackgroundColor = ConsoleColor.Black;
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.Clear();
                    DashCMD.stdWrite(title);
                    Draw();
                    if (!firstStep)
                    {
                        Console.SetWindowPosition(Console.WindowLeft, top);
                    }
                    else
                    {
                        firstStep = false;
                        Console.SetWindowPosition(Console.WindowLeft, 0);
                    }
                    Thread.Sleep(SleepTime);
                } while (IsActive);
            }
            else
            {
                int top = Console.WindowTop;
                Console.BackgroundColor = ConsoleColor.Black;
                Console.ForegroundColor = ConsoleColor.White;
                Console.Clear();
                DashCMD.stdWrite(title);
                Draw();
                Console.SetWindowPosition(Console.WindowLeft, 0);
            }
        }