private void FinalizeRoundBtn_Click(object sender, RoutedEventArgs e) { //Confirm that all matchups in active round are complete //Build matchups for next round var activeRound = tournament.Rounds.Where(x => x.RoundNum == tournament.ActiveRound).First(); var isRoundComplete = tournamentController.validateRoundCompletion(activeRound); if (!isRoundComplete) { lblFinalized.Content = "Active round not finished"; return; //Error Message somewhere } var isActiveRoundValid = tournamentController.validateActiveRound(tournament); if (isActiveRoundValid) { tournament = tournamentController.advanceRound(tournament); source.saveActiveRound(tournament); lblFinalized.Content = "Round finalized"; } else { lblFinalized.Content = "Tournament is over"; resultsBtn.Visibility = Visibility.Visible; } }
public TournamentViewUI(ITournament inTourney, bool fullAccess = true) { InitializeComponent(); source = ApplicationController.getProvider(); tournamentController = ApplicationController.getTournamentController(); tournament = inTourney; //Add all the rounds to the Rounds view populateRoundList(); //Set tournament Name tournamentNameLbl.Content = tournament.TournamentName; //Results Button var activeRound = tournament.Rounds.Where(x => x.RoundNum == tournament.ActiveRound).First(); var isActiveRoundValid = tournamentController.validateActiveRound(tournament); if (!isActiveRoundValid) { resultsBtn.Visibility = Visibility.Visible; } matchupGrid.IsEnabled = fullAccess; finalizeRoundBtn.IsEnabled = fullAccess; populateMatchupListBox(0); initialization = false; }