ResultsBrowser: Bench names can be configured.

This commit is contained in:
Milan Hanajik 2016-05-20 13:04:07 +02:00
parent 03a992d480
commit 4ea85a0644
5 changed files with 715 additions and 642 deletions

View File

@ -28,117 +28,135 @@
/// </summary>
private void InitializeComponent()
{
this.textBox10 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textBox11 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox12 = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(85, 23);
this.textBox10.Name = "textBox10";
this.textBox10.Size = new System.Drawing.Size(555, 20);
this.textBox10.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(26, 26);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(39, 13);
this.label1.TabIndex = 1;
this.label1.Text = "PT300";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(26, 52);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(39, 13);
this.label2.TabIndex = 3;
this.label2.Text = "PT150";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(85, 49);
this.textBox11.Name = "textBox11";
this.textBox11.Size = new System.Drawing.Size(555, 20);
this.textBox11.TabIndex = 2;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(26, 78);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(33, 13);
this.label3.TabIndex = 5;
this.label3.Text = "PT50";
//
// textBox12
//
this.textBox12.Location = new System.Drawing.Point(85, 75);
this.textBox12.Name = "textBox12";
this.textBox12.Size = new System.Drawing.Size(555, 20);
this.textBox12.TabIndex = 4;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(434, 109);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(95, 38);
this.okButton.TabIndex = 6;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(545, 109);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(95, 38);
this.cancelButton.TabIndex = 7;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// DatabaseSettings
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(668, 159);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox12);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox11);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox10);
this.Name = "DatabaseSettings";
this.Text = "Database Settings";
this.Load += new System.EventHandler(this.DatabaseSettings_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.connectionStringTextBox1 = new System.Windows.Forms.TextBox();
this.benchNameLabel = new System.Windows.Forms.Label();
this.connectionStringLabel = new System.Windows.Forms.Label();
this.connectionStringTextBox2 = new System.Windows.Forms.TextBox();
this.connectionStringTextBox3 = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.benchNameTextBox1 = new System.Windows.Forms.TextBox();
this.benchNameTextBox2 = new System.Windows.Forms.TextBox();
this.benchNameTextBox3 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// connectionStringTextBox1
//
this.connectionStringTextBox1.Location = new System.Drawing.Point(157, 45);
this.connectionStringTextBox1.Name = "connectionStringTextBox1";
this.connectionStringTextBox1.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox1.TabIndex = 0;
//
// benchNameLabel
//
this.benchNameLabel.AutoSize = true;
this.benchNameLabel.Location = new System.Drawing.Point(26, 20);
this.benchNameLabel.Name = "benchNameLabel";
this.benchNameLabel.Size = new System.Drawing.Size(67, 13);
this.benchNameLabel.TabIndex = 1;
this.benchNameLabel.Text = "Bench name";
//
// connectionStringLabel
//
this.connectionStringLabel.AutoSize = true;
this.connectionStringLabel.Location = new System.Drawing.Point(154, 20);
this.connectionStringLabel.Name = "connectionStringLabel";
this.connectionStringLabel.Size = new System.Drawing.Size(89, 13);
this.connectionStringLabel.TabIndex = 3;
this.connectionStringLabel.Text = "Connection string";
//
// connectionStringTextBox2
//
this.connectionStringTextBox2.Location = new System.Drawing.Point(157, 71);
this.connectionStringTextBox2.Name = "connectionStringTextBox2";
this.connectionStringTextBox2.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox2.TabIndex = 2;
//
// connectionStringTextBox3
//
this.connectionStringTextBox3.Location = new System.Drawing.Point(157, 97);
this.connectionStringTextBox3.Name = "connectionStringTextBox3";
this.connectionStringTextBox3.Size = new System.Drawing.Size(555, 20);
this.connectionStringTextBox3.TabIndex = 4;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(506, 135);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(95, 38);
this.okButton.TabIndex = 6;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(617, 135);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(95, 38);
this.cancelButton.TabIndex = 7;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// benchNameTextBox1
//
this.benchNameTextBox1.Location = new System.Drawing.Point(29, 45);
this.benchNameTextBox1.Name = "benchNameTextBox1";
this.benchNameTextBox1.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox1.TabIndex = 8;
//
// benchNameTextBox2
//
this.benchNameTextBox2.Location = new System.Drawing.Point(29, 71);
this.benchNameTextBox2.Name = "benchNameTextBox2";
this.benchNameTextBox2.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox2.TabIndex = 9;
//
// benchNameTextBox3
//
this.benchNameTextBox3.Location = new System.Drawing.Point(29, 97);
this.benchNameTextBox3.Name = "benchNameTextBox3";
this.benchNameTextBox3.Size = new System.Drawing.Size(100, 20);
this.benchNameTextBox3.TabIndex = 10;
//
// DatabaseSettings
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(743, 189);
this.Controls.Add(this.benchNameTextBox3);
this.Controls.Add(this.benchNameTextBox2);
this.Controls.Add(this.benchNameTextBox1);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.connectionStringTextBox3);
this.Controls.Add(this.connectionStringLabel);
this.Controls.Add(this.connectionStringTextBox2);
this.Controls.Add(this.benchNameLabel);
this.Controls.Add(this.connectionStringTextBox1);
this.Name = "DatabaseSettings";
this.Text = "Database Settings";
this.Load += new System.EventHandler(this.DatabaseSettings_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox10;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox11;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox12;
private System.Windows.Forms.TextBox connectionStringTextBox1;
private System.Windows.Forms.Label benchNameLabel;
private System.Windows.Forms.Label connectionStringLabel;
private System.Windows.Forms.TextBox connectionStringTextBox2;
private System.Windows.Forms.TextBox connectionStringTextBox3;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.TextBox benchNameTextBox1;
private System.Windows.Forms.TextBox benchNameTextBox2;
private System.Windows.Forms.TextBox benchNameTextBox3;
}
}

View File

@ -18,16 +18,30 @@ namespace ResultsBrowser.Forms
private void DatabaseSettings_Load(object sender, EventArgs e)
{
textBox10.Text = Program.LocalSettings.ConnectionString1;
textBox11.Text = Program.LocalSettings.ConnectionString2;
textBox12.Text = Program.LocalSettings.ConnectionString3;
Localize();
benchNameTextBox1.Text = Program.LocalSettings.Bench1;
benchNameTextBox2.Text = Program.LocalSettings.Bench2;
benchNameTextBox3.Text = Program.LocalSettings.Bench3;
connectionStringTextBox1.Text = Program.LocalSettings.ConnectionString1;
connectionStringTextBox2.Text = Program.LocalSettings.ConnectionString2;
connectionStringTextBox3.Text = Program.LocalSettings.ConnectionString3;
}
void Localize()
{
benchNameLabel.Text = "Bench name";
connectionStringLabel.Text = "Connection string"; /// TODO: Use resources
}
private void okButton_Click(object sender, EventArgs e)
{
Program.LocalSettings.ConnectionString1 = textBox10.Text;
Program.LocalSettings.ConnectionString2 = textBox11.Text;
Program.LocalSettings.ConnectionString3 = textBox12.Text;
Program.LocalSettings.Bench1 = benchNameTextBox1.Text;
Program.LocalSettings.Bench2 = benchNameTextBox2.Text;
Program.LocalSettings.Bench3 = benchNameTextBox3.Text;
Program.LocalSettings.ConnectionString1 = connectionStringTextBox1.Text;
Program.LocalSettings.ConnectionString2 = connectionStringTextBox2.Text;
Program.LocalSettings.ConnectionString3 = connectionStringTextBox3.Text;
Program.LocalSettings.Save();

View File

@ -23,6 +23,10 @@ namespace ResultsBrowser
/// </summary>
public string Language = "en";
public string Bench1;
public string Bench2;
public string Bench3;
/// <summary>C:\VSProjects\TBF\TestBenchFramework\LocalSettings.cs
/// Names and database settings of test benches.
/// </summary>

File diff suppressed because it is too large Load Diff

View File

@ -64,11 +64,45 @@ namespace ResultsBrowser
batchNrToTextBox.Text = Program.LocalSettings.BatchTo;
Results.DB.ConnectionString = Program.LocalSettings.ConnectionString1;
radioButton1.Checked = true;
UpdateRadioButtons();
radioButton1.Checked = true;
radioButton2.Checked = false;
radioButton3.Checked = false;
}
void UpdateRadioButtons()
{
if (string.IsNullOrEmpty(Program.LocalSettings.Bench1))
{
radioButton1.Visible = false;
}
else
{
radioButton1.Visible = true;
radioButton1.Text = Program.LocalSettings.Bench1;
}
if (string.IsNullOrEmpty(Program.LocalSettings.Bench2))
{
radioButton2.Visible = false;
}
else
{
radioButton2.Visible = true;
radioButton2.Text = Program.LocalSettings.Bench1;
}
if (string.IsNullOrEmpty(Program.LocalSettings.Bench3))
{
radioButton3.Visible = false;
}
else
{
radioButton3.Visible = true;
radioButton3.Text = Program.LocalSettings.Bench1;
}
}
private void MainWnd_FormClosing(object sender, FormClosingEventArgs e)
{
Program.LocalSettings.UpdateHistory(purchaseOrderComboBox.Text, ref Program.LocalSettings.PurchaseOrderHistory);
@ -387,7 +421,10 @@ namespace ResultsBrowser
if ((new Forms.DatabaseSettings()).ShowDialog() == DialogResult.OK)
{
Results.DB.ConnectionString = Program.LocalSettings.ConnectionString1;
}
radioButton1.Text = Program.LocalSettings.Bench1;
radioButton2.Text = Program.LocalSettings.Bench2;
radioButton3.Text = Program.LocalSettings.Bench3;
}
}