コード例 #1
0
        void run()
        {
            while (true)
            {
                hasError = false;
                print("Application start.");
                taskDownload.start();
                taskUpload.start();
                taskExecute.start();
                taskKill.start();
                taskSQL.start();

                print("All tasks started. Wait for completion...");

                while (!hasError)
                {
                    Thread.Sleep(500);
                }

                Buzzer.Beep();
                print("Auto revive in " + reviveTime + " seconds.");
                int reviveCount = reviveTime;
                while (reviveCount >= 0)
                {
                    string msg = "\rAuto revive in " + reviveCount + " seconds";
                    string dots;
                    if (reviveCount % 3 == 0)
                    {
                        dots = "...";
                    }
                    else if (reviveCount % 3 == 1)
                    {
                        dots = "..";
                    }
                    else
                    {
                        dots = ".";
                    }
                    Console.Write("\r" + new string(' ', Console.WindowWidth - 1) + "\r");
                    Console.Write(msg + dots);
                    Thread.Sleep(1000);
                    reviveCount--;
                }

                isTerminating = false;
                if (reviveFromDead)
                {
                    print("The program revive now.");
                    continue;
                }
                else
                {
                    break;
                }
            }
            print("Press <Enter> to exit.");
            Console.ReadLine();
        }