private void populateMatchupListBox(int selectedIndex) { var matchupIndex = matchupsListBox.SelectedIndex; matchupsListBox.SelectedItem = null; matchupsListBox.Items.Clear(); var selectedRound = tournament.Rounds[selectedIndex]; foreach (var matchup in selectedRound.Matchups) { if (matchup != null && matchup.MatchupEntries.Count == 2) { String imageURLString = "Assets/x-button.png"; if (matchup.Completed == true) { imageURLString = "Assets/confirm.png"; } var team1Name = tournament.Teams.Find(x => x.TeamId == matchup.MatchupEntries[0].TheTeam.TeamId).TeamName; var team2Name = tournament.Teams.Find(x => x.TeamId == matchup.MatchupEntries[1].TheTeam.TeamId).TeamName; TournamentViewListBoxItem matchupsItem = new TournamentViewListBoxItem() { Team1Name = team1Name, Team2Name = team2Name, imageURL = imageURLString, Completed = matchup.Completed }; matchupsListBox.Items.Add(matchupsItem); } } if (matchupIndex != -1) { matchupsListBox.SelectedIndex = matchupIndex; } }
private bool MatchupFilter(object item) { TournamentViewListBoxItem matchup = item as TournamentViewListBoxItem; return(!matchup.Completed); }