diff options
author | emkael <emkael@tlen.pl> | 2017-07-30 00:51:34 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-07-30 00:51:34 +0200 |
commit | c826889695c08a76c0e4c4f5d8ae126a3eb09ab6 (patch) | |
tree | 0ecfbda705a6be5f4d29470aca2c594029cc8f69 /Aktywator/MainForm.cs | |
parent | 04f325bbb2f9cfcfdf699b28057651f4a6a50541 (diff) |
Tournament info code refactored for incoming generalization
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 |