summaryrefslogtreecommitdiff
path: root/Aktywator/MainForm.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Aktywator/MainForm.cs')
-rw-r--r--Aktywator/MainForm.cs84
1 files changed, 57 insertions, 27 deletions
diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs
index b1efe50..01c7e19 100644
--- a/Aktywator/MainForm.cs
+++ b/Aktywator/MainForm.cs
@@ -12,8 +12,8 @@ namespace Aktywator
{
public partial class MainForm : Form
{
- public string version = "1.0.8";
- public string date = "27.07.2017";
+ public string version = "1.1.0-beta";
+ public string date = "30.07.2017";
private Bws bws;
private List<Setting> bwsSettings;
@@ -292,7 +292,7 @@ namespace Aktywator
}
}
- private void bTournament_Click(object sender, EventArgs e)
+ private void bMySQLTournament_Click(object sender, EventArgs e)
{
try
{
@@ -300,29 +300,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)
@@ -331,6 +310,57 @@ namespace Aktywator
}
}
+ private void bRRBTournament_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ OpenFileDialog fDialog = new OpenFileDialog();
+ fDialog.Filter = "RRBrigde tournament files (*.rrt)|*.rrt";
+ fDialog.RestoreDirectory = true;
+ if (fDialog.ShowDialog() == DialogResult.OK)
+ {
+ tournament = new RRBTournament(fDialog.FileName);
+ updateTournamentInfo(tournament);
+ }
+ }
+ catch (Exception ee)
+ {
+ MessageBox.Show(ee.Message, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Stop);
+ }
+ }
+
+ 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.GetType().Equals(typeof(TeamyTournament)))
+ {
+ 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
@@ -374,7 +404,7 @@ namespace Aktywator
timer.Interval = interval * 1000;
eInterval.Enabled = false;
bAutoSync.Text = "pracuje się...";
- bTournament.Enabled = false;
+ bMySQLTournament.Enabled = false;
bMysqlSettings.Enabled = false;
timer.Enabled = true;
}
@@ -383,7 +413,7 @@ namespace Aktywator
timer.Enabled = false;
bAutoSync.Text = "Synchronizuj cyklicznie";
eInterval.Enabled = true;
- bTournament.Enabled = true;
+ bMySQLTournament.Enabled = true;
bMysqlSettings.Enabled = true;
}
}