From 5b9b179e9623c8b6935976ac537b2f9a1996486a Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 24 Oct 2018 14:57:21 +0200 Subject: Scoring type configuration support Fixes michzimny/aktywator#43 --- Aktywator/MainForm.cs | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'Aktywator/MainForm.cs') diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index ecf52c5..0f456ea 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -26,6 +26,8 @@ namespace Aktywator public static Version requiredBCSVersion; public static Version requiredFWVersion; + private Dictionary _scoringType; + public MainForm() { InitializeComponent(); @@ -34,6 +36,11 @@ namespace Aktywator private void MainForm_Load(object sender, EventArgs e) { if (!MySQL.getConfigured()) (new MysqlSettings()).ShowDialog(); + this._scoringType = new Dictionary(); + this._scoringType.Add(this.rbMatchpoints, 1); + this._scoringType.Add(this.rbIMPCavendish, 2); + this._scoringType.Add(this.rbIMPButler, 3); + this._scoringType.Add(this.rbIMPTeams, 4); } private void MainForm_Shown(object sender, EventArgs e) @@ -97,7 +104,6 @@ namespace Aktywator { syncToolStrip.Visible = false; namesPanel.Visible = false; - this.rbMatchpoints.Checked = true; } this.WindowState = FormWindowState.Normal; @@ -744,5 +750,27 @@ namespace Aktywator this.rbIMPTeams.Enabled = xShowPercentage.Checked && teamsTournament; } + internal int getScoringType() + { + if (this.xShowPercentage.Checked) + { + foreach (KeyValuePair type in this._scoringType) + { + if (type.Key.Checked) + { + return type.Value; + } + } + } + return 0; + } + + internal void setScoringType(int scoringType) + { + foreach (KeyValuePair type in this._scoringType) + { + type.Key.Checked = (type.Value == scoringType); + } + } } } -- cgit v1.2.3