示例#1
0
 /// <summary>
 /// First thing we do is add the new players to the tournament. 
 /// TODO Now we loop over all the games each time the button is pressed and clear the list each time, finally we add for each game a new viewmodel.
 /// TODO Would there be a way or is it necessary to add only the new games?
 /// We have to clear the Observable Games list each time or duplicate viewmodels get added.
 /// </summary>
 private void PairUp()
 {
     AddNewPlayers();
     CurrentTournament.PairUp();
     Games.Clear();
     foreach (Game game in CurrentTournament.Games)
     {
         GameViewModel gameViewModel = new GameViewModel(game);
         Games.Add(gameViewModel);
     }
     RaisePropertyChanged("PlayersRanked");
 }
示例#2
0
 private void InitTournament()
 {
     foreach (Game game in CurrentTournament.Games)
     {
         GameViewModel gameViewModel = new GameViewModel(game);
         Games.Add(gameViewModel);
     }
     foreach (Player player in CurrentTournament.Players)
     {
         PlayerViewModel playerViewModel = new PlayerViewModel(player);
         Players.Add(playerViewModel);
         foreach(Game game in CurrentTournament.Games)
         {
             if(game.BlackPlayer.Equals(player)||game.WhitePlayer.Equals(player))
             {
                 player.Games.Add(game);
             }
         }
     }
 }