示例#1
0
文件: Program.cs 项目: KotaMg/Hangman
        static void Main(string[] args)
        {
            bool keepPlaying = true;

            while (keepPlaying)
            {
                Console.Clear();
                Hangman hangman = new Hangman();
                keepPlaying = Validation.BoolValidation("\r\nKeep playing? (yes/no)");
            }
        }
示例#2
0
文件: ch011-1.cs 项目: takwas/niit
        static void Main(string[] args)
        {
            Console.Clear();
            Console.WriteLine("You have to complete the game within 60 seconds");
            Hangman obj       = new Hangman();
            int     returnVal = obj.AcceptCategory();

            if (returnVal == 1)
            {
                //obj.StartGame();
                Thread t = new Thread(new ThreadStart(obj.StartGame));
                t.Start();           //Starting the new thread
                Thread.Sleep(60000); //Making the Main thread sleep for 90 Seconds
                try
                {
                    t.Abort();
                    Console.WriteLine("Time Over");
                }//Killing the new thread
                catch (ThreadAbortException e) { Console.WriteLine(e.Message); }
            }

            Console.ReadLine();
        }
示例#3
0
文件: ch011-1.cs 项目: takwas/niit
        static void Main(string[] args)
        {
            Console.Clear();
            Console.WriteLine("You have to complete the game within 60 seconds");
            Hangman obj = new Hangman();
            int returnVal = obj.AcceptCategory();
            if (returnVal == 1)
            {

                //obj.StartGame();
                Thread t = new Thread(new ThreadStart(obj.StartGame));
                t.Start();//Starting the new thread
                Thread.Sleep(60000);//Making the Main thread sleep for 90 Seconds
                try
                {
                    t.Abort();
                    Console.WriteLine("Time Over");
                }//Killing the new thread
                catch (ThreadAbortException e) { Console.WriteLine(e.Message); }

            }

            Console.ReadLine();
        }