private void divisionSelector_SelectedIndexChanged(object sender, EventArgs e) { teamSelector.Items.Clear(); teamSelector.Items.Add(Constants.AllText); SetUIVisibility(); if (!SelectedDivision.Equals(Constants.AllText)) { //Populate the teamSelector with the teams in the selected division Division selected = mLeague.FindDivision(SelectedConference, SelectedDivision); foreach (Team team in selected.Teams) { teamSelector.Items.Add(team.Name); } } if (teamSelector.SelectedIndex != 0) { teamSelector.SelectedIndex = 0; } else { UpdateDisplay(); } }
private void SetUIVisibility() { DisplayType currentDisplay = CurrentDisplay; bool conferenceSelected = !SelectedConference.Equals(Constants.AllText); divisionLabel.Visible = conferenceSelected; divisionSelector.Visible = conferenceSelected; bool divisionSelected = conferenceSelected && SelectedDivision != null && !SelectedDivision.Equals(Constants.AllText); teamLabel.Visible = conferenceSelected && divisionSelected; teamSelector.Visible = conferenceSelected && divisionSelected; analyzeButton.Enabled = divisionSelected; ShowHideTab(leagueTab, currentDisplay == DisplayType.League); ShowHideTab(conferenceTab, currentDisplay == DisplayType.Conference); ShowHideTab(divisionTab, currentDisplay == DisplayType.Division); ShowHideTab(teamTab, currentDisplay == DisplayType.Team); }