private void State3_Grup2Button_Click(object sender, EventArgs e) { try { PongGameField name = new PongGameField(tournament.Rounds[3][1]); name.CurrentMatch.WinEvent += (s, a) => { ((Button)sender).Enabled = false; ShowInTaskbar = true; Show(); }; ShowInTaskbar = false; Hide(); name.Show(); name.CurrentMatch.WinEvent += (s, a) => { if (a.Winner.ID == name.CurrentMatch.PlayerOne.ID) { State3_P3.BackColor = Color.Green; State3_P4.BackColor = Color.Red; } else if (name.CurrentMatch.WinnerID == name.CurrentMatch.PlayerTwo.ID) { State3_P3.BackColor = Color.Red; State3_P4.BackColor = Color.Green; } }; } catch { MessageBox.Show("Мачът не съществува!"); } }
private void State4_Grup1Button_Click(object sender, EventArgs e) { try { PongGameField name = new PongGameField(tournament.Rounds[4][0]); name.CurrentMatch.WinEvent += (s, a) => { ((Button)sender).Enabled = false; ShowInTaskbar = true; Show(); }; ShowInTaskbar = false; Hide(); name.Show(); name.CurrentMatch.WinEvent += (s, a) => { if (a.Winner.ID == name.CurrentMatch.PlayerOne.ID) { State4_P1.BackColor = Color.Gold; State4_P2.BackColor = Color.Silver; } else if (name.CurrentMatch.WinnerID == name.CurrentMatch.PlayerTwo.ID) { State4_P1.BackColor = Color.Silver; State4_P2.BackColor = Color.Gold; } ExitButton.Show(); }; } catch { MessageBox.Show("Мачът не съществува!"); } }
private void EighthGrupButton_Click(object sender, EventArgs e) { PongGameField name = new PongGameField(tournament.Rounds[1][7]); name.CurrentMatch.WinEvent += (s, a) => { ((Button)sender).Enabled = false; ShowInTaskbar = true; Show(); }; ShowInTaskbar = false; Hide(); name.Show(); name.CurrentMatch.WinEvent += (s, a) => { if (a.Winner.ID == name.CurrentMatch.PlayerOne.ID) { player15.BackColor = Color.Green; player16.BackColor = Color.Red; } else if (name.CurrentMatch.WinnerID == name.CurrentMatch.PlayerTwo.ID) { player15.BackColor = Color.Red; player16.BackColor = Color.Green; } }; }