/// <summary> /// Start the matchs of the final phase for 8 or 10 players /// </summary> public void StartTree() { if (this.Results.Count == 5) { Course match1 = new Course(this.Results[4], this.Results[2]); frmMatch matchWindow = new frmMatch(match1); matchWindow.ShowDialog(); lblTeamWon1.Text = match1.GetWinner().GetName(); lblTeamP1.Text = match1.GetLooser().GetName(); Course match4 = new Course(); match4.Team1 = match1.GetWinner(); Course match3 = new Course(this.Results[0], match1.GetLooser()); Course match2 = new Course(this.Results[3], this.Results[1]); matchWindow = new frmMatch(match2); matchWindow.ShowDialog(); lblTeamWon2.Text = match2.GetWinner().GetName(); lblTeamP2.Text = match2.GetLooser().GetName(); match4.Team2 = match2.GetWinner(); Course match5 = new Course(); match5.Team2 = match2.GetLooser(); matchWindow = new frmMatch(match3); matchWindow.ShowDialog(); lblTeamWon3.Text = match3.GetWinner().GetName(); match5.Team1 = match3.GetWinner(); matchWindow = new frmMatch(match4); matchWindow.ShowDialog(); lblTeamWon4.Text = match4.GetWinner().GetName(); Course match6 = new Course(); match6.Team1 = match4.GetWinner(); matchWindow = new frmMatch(match5); matchWindow.ShowDialog(); lblTeamWon5.Text = match5.GetWinner().GetName(); match6.Team2 = match5.GetWinner(); matchWindow = new frmMatch(match6); matchWindow.ShowDialog(); lblWinner.Text = match6.GetWinner().GetName(); MessageBox.Show(match6.GetWinner().GetName() + " Gagnent !"); } if (this.Results.Count() == 4) { Course match1 = new Course(this.Results[3], this.Results[1]); frmMatch matchWindow = new frmMatch(match1); matchWindow.ShowDialog(); lblTeamWon4.Text = match1.GetWinner().GetName(); Course match3 = new Course(); match3.Team1 = match1.GetWinner(); Course match2 = new Course(this.Results[2], this.Results[0]); matchWindow = new frmMatch(match2); matchWindow.ShowDialog(); lblTeamWon5.Text = match2.GetWinner().GetName(); match3.Team2 = match2.GetWinner(); matchWindow = new frmMatch(match3); matchWindow.ShowDialog(); lblWinner.Text = match3.GetWinner().GetName(); MessageBox.Show(match3.GetWinner().GetName() + " Gagnent !"); } }
/// <summary> /// Go through all the matchs and show a window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStart_Click(object sender, EventArgs e) { btnStart.Enabled = false; Course match = this.Tournament.StartPools(); while (match != null) { frmMatch matchWindow = new frmMatch(match); matchWindow.ShowDialog(); lsbResults.Items.Add(match); this.Tournament.Courses[this.Tournament.CurrentCourse] = matchWindow.CurrentMatch; match = this.Tournament.NextCourse(); this.lsbTeams.DataSource = null; this.lsbTeams.DataSource = this.Tournament.Teams; } this.lsbTeams.DataSource = null; this.lsbTeams.DataSource = this.Tournament.Teams; btnStartFinals.Enabled = true; }