summaryrefslogtreecommitdiff
path: root/Aktywator/ChooseTournament.cs
diff options
context:
space:
mode:
authorMichał Zimniewicz <michzimny@users.noreply.github.com>2017-12-06 23:57:31 +0100
committerGitHub <noreply@github.com>2017-12-06 23:57:31 +0100
commit80cd31c1c8e7cef2cfbf6148df3d9ec2d2a23279 (patch)
tree4071e574a3e611cf4d8a19e231ff7ecc659949fa /Aktywator/ChooseTournament.cs
parent83e064ccb67f0b68b1f947026301cd3905d06a3c (diff)
parentf12d2b996b165d66f4c32eef4a3bdfb89309670d (diff)
Merge pull request #29 from michzimny/1.1-beta
Scalenie gałęzi beta do master
Diffstat (limited to 'Aktywator/ChooseTournament.cs')
-rw-r--r--Aktywator/ChooseTournament.cs29
1 files changed, 22 insertions, 7 deletions
diff --git a/Aktywator/ChooseTournament.cs b/Aktywator/ChooseTournament.cs
index 2bc2ded..2a7316f 100644
--- a/Aktywator/ChooseTournament.cs
+++ b/Aktywator/ChooseTournament.cs
@@ -8,10 +8,17 @@ using System.Windows.Forms;
namespace Aktywator
{
+ public struct TournamentListItem
+ {
+ public int Type;
+ public string Name;
+ public string Label;
+ }
+
public partial class ChooseTournament : Form
{
- private Tournament[] turns;
- public Tournament chosenTournament;
+ private TournamentListItem[] turns;
+ public MySQLTournament chosenTournament;
public ChooseTournament()
{
@@ -20,13 +27,13 @@ namespace Aktywator
private void ChooseTournament_Load(object sender, EventArgs e)
{
- List<Tournament> list = Tournament.getTournaments();
- turns = new Tournament[list.Count];
+ List<TournamentListItem> list = MySQLTournament.getTournaments();
+ turns = new TournamentListItem[list.Count];
int c = 0;
- foreach (Tournament t in list)
+ foreach (TournamentListItem t in list)
{
turns[c++] = t;
- listBox.Items.Add(t.ToString());
+ listBox.Items.Add(t.Label);
}
}
@@ -34,7 +41,15 @@ namespace Aktywator
{
if (listBox.SelectedIndex >= 0)
{
- chosenTournament = turns[listBox.SelectedIndex];
+ switch (turns[listBox.SelectedIndex].Type)
+ {
+ case Tournament.TYPE_PARY:
+ chosenTournament = new ParyTournament(turns[listBox.SelectedIndex].Name);
+ break;
+ case Tournament.TYPE_TEAMY:
+ chosenTournament = new TeamyTournament(turns[listBox.SelectedIndex].Name);
+ break;
+ }
Close();
}
}