summaryrefslogtreecommitdiff
path: root/Aktywator/Bws.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Aktywator/Bws.cs')
-rw-r--r--Aktywator/Bws.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs
index 5793417..13067cf 100644
--- a/Aktywator/Bws.cs
+++ b/Aktywator/Bws.cs
@@ -86,7 +86,7 @@ namespace Aktywator
settings.Add(new Setting("ShowResults", main.xShowResults, this, new Version(2, 0, 0), new Version(1, 3, 1)));
settings.Add(new Setting("RepeatResults", main.xRepeatResults, this, null, null));
settings.Add(new Setting("ShowPercentage", main.xShowPercentage, this, null, null));
- //settings.Add(new Setting("GroupSections", main.xGroupSections, this, null, null));
+ settings.Add(new Setting("GroupSections", main.xGroupSections, this, new Version(2, 1, 10), new Version(1, 3, 1)));
settings.Add(new Setting("ShowPairNumbers", main.xShowPairNumbers, this, null, null));
settings.Add(new Setting("IntermediateResults", main.xIntermediateResults, this, null, new Version(1, 4, 1)));
settings.Add(new Setting("ShowContract", main.xShowContract, this, null, null));
@@ -295,6 +295,7 @@ namespace Aktywator
int resultsOverview = 0;
int.TryParse(Setting.load("BM2ResultsOverview", this, errors, section), out resultsOverview);
main.xResultsOverview.SelectedIndex = resultsOverview;
+ main.xGroupSections.Checked = this.getSectionGroupCount() <= 1;
if (section == null && main.cbSettingsSection.Items.Count > 2)
{
@@ -308,6 +309,17 @@ namespace Aktywator
}
}
+ private int getSectionGroupCount()
+ {
+ OleDbDataReader rows = sql.select("SELECT DISTINCT `Group` FROM Tables");
+ int count = 0;
+ while (rows.Read())
+ {
+ count++;
+ }
+ return count;
+ }
+
public void saveSettings()
{
string section = "*".Equals(main.cbSettingsSection.Text) ? null : this.sectorLetterToNumber(main.cbSettingsSection.Text).ToString();
@@ -329,6 +341,14 @@ namespace Aktywator
Setting.save("BM2NameSource", "2", this, errors, section);
Setting.save("BM2PINcode", "'" + main.xPINcode.Text + "'", this, errors, section);
Setting.save("BM2ResultsOverview", main.xResultsOverview.SelectedIndex.ToString(), this, errors, section);
+ if (main.xGroupSections.Checked)
+ {
+ sql.query("UPDATE Tables SET `Group` = 1;");
+ }
+ else
+ {
+ sql.query("UPDATE Tables SET `Group` = `Section`;");
+ }
this.loadSettings();
}