Exemple #1
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);
            }
        }