diff options
Diffstat (limited to 'Aktywator/MainForm.cs')
-rw-r--r-- | Aktywator/MainForm.cs | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 24f300c..55e2f53 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -171,29 +171,8 @@ namespace Aktywator choose.ShowDialog(); if (choose.chosenTournament != null) { - if ((tournament != null) && (tournament.mysql != null)) - tournament.mysql.close(); - tournament = choose.chosenTournament; - tournament.mysql.connect(); - - lTournament.Text = tournament.name; - lType.Text = tournament.type == 1 ? "Pary" : "Teamy"; - lSections.Text = tournament.getSectionsNum(); - lTables.Text = tournament.getTablesNum(); - bSync.Enabled = true; - bAutoSync.Enabled = true; - eInterval.Enabled = true; - if (tournament.type == 2) - { - lSkok.Visible = true; - lNazwyTeamow.Visible = true; - } - else - { - lSkok.Visible = false; - lNazwyTeamow.Visible = false; - } + updateTournamentInfo(tournament); } } catch (Exception ee) @@ -202,6 +181,37 @@ namespace Aktywator } } + private void updateTournamentInfo(Tournament tournament) + { + if (tournament != null) + { + tournament.setup(); + + lTournament.Text = tournament.getName(); + lType.Text = tournament.getTypeLabel(); + lSections.Text = tournament.getSectionsNum(); + lTables.Text = tournament.getTablesNum(); + bSync.Enabled = true; + bAutoSync.Enabled = true; + eInterval.Enabled = true; + if (tournament.type == Tournament.TYPE_TEAMY) + { + lSkok.Visible = true; + lNazwyTeamow.Visible = true; + } + else + { + lSkok.Visible = false; + lNazwyTeamow.Visible = false; + } + } + else + { + lSkok.Visible = false; + lNazwyTeamow.Visible = false; + } + } + private void bSync_Click(object sender, EventArgs e) { try |