public GameViewModel()
        {
            Game = new Game(new HumanPlayer("Player 1"), new HumanPlayer("Player 2"));
            Player1Name = Game.Player1.Name;
            Player2Name = Game.Player2.Name;
            Game.PropertyChanged += GameOnPropertyChanged;
            GameBoardViewModel = new GameBoardViewModel(this);
            var t = new System.Timers.Timer(1000);
            t.Elapsed += (sender, args) =>
            {

            };
            t.Start();
        }
 public GameBoard(GameBoardViewModel vm)
 {
     Vm = vm;
     InitializeComponent();
 }
 private void GameOnPropertyChanged(object sender, PropertyChangedEventArgs args)
 {
     OnPropertyChanged("IsPlayer1Turn");
     OnPropertyChanged("IsPlayer2Turn");
     OnPropertyChanged("ShowPlayerName");
     if (args.PropertyName == "Status")
     {
         if (Game.Status == GameStatus.Finished)
         {
             if (Game.Winner == Game.Player1)
             {
                 Player1WinCount++;
             }
             else if (Game.Winner == Game.Player2)
             {
                 Player2WinCount++;
             }
             else if (Game.WinStatus == GameWinStatus.Tie)
             {
                 TieCount++;
             }
             Task.Factory.StartNew(() =>
             {
                 Thread.Sleep(5000);
                 Game.Reset();
                 Game.Start();
                 Dispatcher.Invoke(new Action(() =>
                 {
                     GameBoardViewModel.Dispose();
                     GameBoardViewModel = new GameBoardViewModel(this);
                 }));
             });
         }
     }
 }
 public void Reset(IPlayer player1, IPlayer player2)
 {
     GameBoardViewModel.Dispose();
     Game.PropertyChanged -= GameOnPropertyChanged;
     if(Game != null)
         Game.Dispose();
     Game = new Game(player1, player2);
     Game.PropertyChanged += GameOnPropertyChanged;
     GameBoardViewModel = new GameBoardViewModel(this);
     Player1WinCount = 0;
     Player2WinCount = 0;
     TieCount = 0;
 }