summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-11-26 16:26:16 +0100
committeremkael <emkael@tlen.pl>2016-11-26 16:26:16 +0100
commit2f47067c7b0db33b6b5e9fe1c846c054b75256e2 (patch)
tree44c4f587123ec4ca4f5f073b36eb05530cb91311
parent665e91d1a86047d726aebc7cf14c2441a36b484e (diff)
* load only boards necessary for existing sections
-rw-r--r--Aktywator/Bws.cs38
-rw-r--r--Aktywator/MainForm.Designer.cs2
2 files changed, 35 insertions, 5 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs
index ba11b72..381e10f 100644
--- a/Aktywator/Bws.cs
+++ b/Aktywator/Bws.cs
@@ -27,7 +27,35 @@ namespace Aktywator
this._filename = filename;
sql = new Sql(filename);
this.main = main;
- main.lWczytywane.Text += this.lowBoard() + "-" + this.highBoard();
+ main.lWczytywane.Text = this.getBoardRangeText(this.getSections().Split(','));
+ }
+
+ private int sectorLetterToNumber(string sector)
+ {
+ return sector[0] - 'A' + 1;
+ }
+
+ private string sectorNumberToLetter(int sector)
+ {
+ char character = (char)('A' - 1 + sector);
+ return character.ToString();
+ }
+
+ private string getBoardRangeText(string[] sectors)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("Wczytywane rozkłady:");
+ foreach (string sector in sectors)
+ {
+ sb.Append("\n ");
+ sb.Append(this.lowBoard(sector));
+ sb.Append("-");
+ sb.Append(this.highBoard(sector));
+ sb.Append(" (sektor ");
+ sb.Append(this.sectorNumberToLetter(Int16.Parse(sector)));
+ sb.Append(")");
+ }
+ return sb.ToString();
}
public void initSettings()
@@ -453,9 +481,10 @@ namespace Aktywator
{
sql.query("DELETE FROM HandRecord");
sql.query("DELETE FROM HandEvaluation");
- for (int i = 0; i < pbn.handRecords.Length; i++)
- if (pbn.handRecords[i] != null)
- for (int section = lowSection(); section <= highSection(); section++)
+ foreach (string section in this.getSections().Split(','))
+ {
+ for (int i = this.lowBoard(section.Trim()); i <= this.highBoard(section.Trim()); i++)
+ if (pbn.handRecords[i] != null)
{
HandRecord b = pbn.handRecords[i];
StringBuilder str = new StringBuilder(50);
@@ -506,6 +535,7 @@ namespace Aktywator
sql.query(ddStr.ToString());
}
}
+ }
}
}
}
diff --git a/Aktywator/MainForm.Designer.cs b/Aktywator/MainForm.Designer.cs
index c28159e..2d31fe7 100644
--- a/Aktywator/MainForm.Designer.cs
+++ b/Aktywator/MainForm.Designer.cs
@@ -868,7 +868,7 @@
//
this.lWczytywane.AutoSize = true;
this.lWczytywane.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.lWczytywane.Location = new System.Drawing.Point(192, 99);
+ this.lWczytywane.Location = new System.Drawing.Point(218, 84);
this.lWczytywane.Name = "lWczytywane";
this.lWczytywane.Size = new System.Drawing.Size(139, 13);
this.lWczytywane.TabIndex = 3;