Esempio n. 1
0
        private void PlayNGames(object obj)
        {
            if (nGamesOn)
            {
                return; // Redundancy
            }
            nGame game = (nGame)obj;

            nGamesOn = true;
            int i = 0;

            while (i < game.gameCount && nGamesOn)
            {
                i++;
                Dispatcher.Invoke(new Action(delegate() { NewGame(game.bot1, game.bot2); }));
                while (gameOn)
                {
                    ;            // Wait for game to end
                }
                if (ViewBotsEnd)
                {
                    Thread.Sleep(2000);
                }
                else
                {
                    Thread.Sleep(10);
                }
            }

            Dispatcher.Invoke(new Action(delegate() { GUI.SetWindow_NoGameInProgress(); }));
            nGamesOn        = false;
            _nMatchesThread = null;
        }
Esempio n. 2
0
 public void PlayNGamesThreadStart(nGame game)
 {
     _nMatchesThread = new Thread(PlayNGames);
     _nMatchesThread.IsBackground = true;
     _nMatchesThread.Start(game);
 }