private void Save_Game(object sender, EventArgs e) { //add game to games list Game newGame = new Game(OpponentBox.Text,LocationBox.Text,TournamentBox.Text, Convert.ToInt32(CapBox.Text)); App.GameViewModel.createGame(newGame); //navigate to active game page NavigationService.Navigate(new Uri("/Pages/ActiveGamePage.xaml", UriKind.Relative)); }
public void createGame(Game newGame) { //create a new game instance App.Manager.teams[App.Manager.currentTeam].seasons[App.Manager.currentSeason].games.Add(newGame); //set current game to newly created game App.Manager.currentGame = App.Manager.teams[App.Manager.currentTeam].seasons[App.Manager.currentSeason].games.Count - 1; //for every player on the team, for this season, add him to the specific game instance. foreach (Player player in App.Manager.teams[App.Manager.currentTeam].seasons[App.Manager.currentSeason].players) { App.Manager.teams[App.Manager.currentTeam].seasons[App.Manager.currentSeason].games[App.Manager.currentGame].players.Add(player); } update(); //sets current game instance to the one we just created }