More DataEntry.Combined.CycleBaginningForm: combo boxes used, key-press processed, etc.
This commit is contained in:
parent
2b72e855f1
commit
06d55b287d
@ -33,22 +33,22 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
{
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.aux1ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.main1ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.auxSN1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.auxSN1Label = new System.Windows.Forms.Label();
|
||||
this.mainSN1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.mainSN1Label = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.aux2ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.main2ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.auxSN2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.auxSN2Label = new System.Windows.Forms.Label();
|
||||
this.mainSN2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.mainSN2Label = new System.Windows.Forms.Label();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.aux3ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.main3ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox3 = new System.Windows.Forms.CheckBox();
|
||||
this.auxSN3TextBox = new System.Windows.Forms.TextBox();
|
||||
this.auxSN3Label = new System.Windows.Forms.Label();
|
||||
this.mainSN3TextBox = new System.Windows.Forms.TextBox();
|
||||
this.mainSN3Label = new System.Windows.Forms.Label();
|
||||
this.clearButton = new System.Windows.Forms.Button();
|
||||
this.orderGroupBox = new System.Windows.Forms.GroupBox();
|
||||
@ -73,10 +73,10 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.aux1ComboBox);
|
||||
this.groupBox1.Controls.Add(this.main1ComboBox);
|
||||
this.groupBox1.Controls.Add(this.checkBox1);
|
||||
this.groupBox1.Controls.Add(this.auxSN1TextBox);
|
||||
this.groupBox1.Controls.Add(this.auxSN1Label);
|
||||
this.groupBox1.Controls.Add(this.mainSN1TextBox);
|
||||
this.groupBox1.Controls.Add(this.mainSN1Label);
|
||||
this.groupBox1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.groupBox1.ForeColor = System.Drawing.Color.Black;
|
||||
@ -86,24 +86,43 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
this.groupBox1.TabIndex = 1;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Water Meter 1";
|
||||
this.groupBox1.Visible = false;
|
||||
//
|
||||
// aux1ComboBox
|
||||
//
|
||||
this.aux1ComboBox.FormattingEnabled = true;
|
||||
this.aux1ComboBox.Location = new System.Drawing.Point(262, 83);
|
||||
this.aux1ComboBox.Name = "aux1ComboBox";
|
||||
this.aux1ComboBox.Size = new System.Drawing.Size(200, 31);
|
||||
this.aux1ComboBox.TabIndex = 6;
|
||||
this.aux1ComboBox.Visible = false;
|
||||
this.aux1ComboBox.SelectedIndexChanged += new System.EventHandler(this.aux1ComboBox_SelectedIndexChanged);
|
||||
this.aux1ComboBox.TextChanged += new System.EventHandler(this.aux1ComboBox_TextChanged);
|
||||
this.aux1ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux1ComboBox_KeyPress);
|
||||
//
|
||||
// main1ComboBox
|
||||
//
|
||||
this.main1ComboBox.FormattingEnabled = true;
|
||||
this.main1ComboBox.Location = new System.Drawing.Point(262, 37);
|
||||
this.main1ComboBox.Name = "main1ComboBox";
|
||||
this.main1ComboBox.Size = new System.Drawing.Size(200, 31);
|
||||
this.main1ComboBox.TabIndex = 5;
|
||||
this.main1ComboBox.Visible = false;
|
||||
this.main1ComboBox.SelectedIndexChanged += new System.EventHandler(this.main1ComboBox_SelectedIndexChanged);
|
||||
this.main1ComboBox.TextChanged += new System.EventHandler(this.main1ComboBox_TextChanged);
|
||||
this.main1ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main1ComboBox_KeyPress);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Font = new System.Drawing.Font("Verdana", 27.75F);
|
||||
this.checkBox1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.checkBox1.Location = new System.Drawing.Point(472, 69);
|
||||
this.checkBox1.Location = new System.Drawing.Point(490, 69);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(15, 14);
|
||||
this.checkBox1.TabIndex = 4;
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// auxSN1TextBox
|
||||
//
|
||||
this.auxSN1TextBox.Location = new System.Drawing.Point(262, 83);
|
||||
this.auxSN1TextBox.Name = "auxSN1TextBox";
|
||||
this.auxSN1TextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.auxSN1TextBox.TabIndex = 3;
|
||||
this.checkBox1.Visible = false;
|
||||
//
|
||||
// auxSN1Label
|
||||
//
|
||||
@ -113,13 +132,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
this.auxSN1Label.Size = new System.Drawing.Size(193, 23);
|
||||
this.auxSN1Label.TabIndex = 2;
|
||||
this.auxSN1Label.Text = "Aux. WM Serial Nr.";
|
||||
//
|
||||
// mainSN1TextBox
|
||||
//
|
||||
this.mainSN1TextBox.Location = new System.Drawing.Point(262, 37);
|
||||
this.mainSN1TextBox.Name = "mainSN1TextBox";
|
||||
this.mainSN1TextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.mainSN1TextBox.TabIndex = 1;
|
||||
this.auxSN1Label.Visible = false;
|
||||
//
|
||||
// mainSN1Label
|
||||
//
|
||||
@ -129,13 +142,14 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
this.mainSN1Label.Size = new System.Drawing.Size(195, 23);
|
||||
this.mainSN1Label.TabIndex = 0;
|
||||
this.mainSN1Label.Text = "Main WM Serial Nr.";
|
||||
this.mainSN1Label.Visible = false;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.aux2ComboBox);
|
||||
this.groupBox2.Controls.Add(this.main2ComboBox);
|
||||
this.groupBox2.Controls.Add(this.checkBox2);
|
||||
this.groupBox2.Controls.Add(this.auxSN2TextBox);
|
||||
this.groupBox2.Controls.Add(this.auxSN2Label);
|
||||
this.groupBox2.Controls.Add(this.mainSN2TextBox);
|
||||
this.groupBox2.Controls.Add(this.mainSN2Label);
|
||||
this.groupBox2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.groupBox2.ForeColor = System.Drawing.Color.Black;
|
||||
@ -145,24 +159,43 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
this.groupBox2.TabIndex = 2;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Water Meter 2";
|
||||
this.groupBox2.Visible = false;
|
||||
//
|
||||
// aux2ComboBox
|
||||
//
|
||||
this.aux2ComboBox.FormattingEnabled = true;
|
||||
this.aux2ComboBox.Location = new System.Drawing.Point(262, 83);
|
||||
this.aux2ComboBox.Name = "aux2ComboBox";
|
||||
this.aux2ComboBox.Size = new System.Drawing.Size(200, 31);
|
||||
this.aux2ComboBox.TabIndex = 10;
|
||||
this.aux2ComboBox.Visible = false;
|
||||
this.aux2ComboBox.SelectedIndexChanged += new System.EventHandler(this.aux2ComboBox_SelectedIndexChanged);
|
||||
this.aux2ComboBox.TextChanged += new System.EventHandler(this.aux2ComboBox_TextChanged);
|
||||
this.aux2ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux2ComboBox_KeyPress);
|
||||
//
|
||||
// main2ComboBox
|
||||
//
|
||||
this.main2ComboBox.FormattingEnabled = true;
|
||||
this.main2ComboBox.Location = new System.Drawing.Point(262, 37);
|
||||
this.main2ComboBox.Name = "main2ComboBox";
|
||||
this.main2ComboBox.Size = new System.Drawing.Size(200, 31);
|
||||
this.main2ComboBox.TabIndex = 9;
|
||||
this.main2ComboBox.Visible = false;
|
||||
this.main2ComboBox.SelectedIndexChanged += new System.EventHandler(this.main2ComboBox_SelectedIndexChanged);
|
||||
this.main2ComboBox.TextChanged += new System.EventHandler(this.main2ComboBox_TextChanged);
|
||||
this.main2ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main2ComboBox_KeyPress);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
this.checkBox2.AutoSize = true;
|
||||
this.checkBox2.Font = new System.Drawing.Font("Verdana", 27.75F);
|
||||
this.checkBox2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.checkBox2.Location = new System.Drawing.Point(472, 69);
|
||||
this.checkBox2.Location = new System.Drawing.Point(490, 69);
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.Size = new System.Drawing.Size(15, 14);
|
||||
this.checkBox2.TabIndex = 8;
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// auxSN2TextBox
|
||||
//
|
||||
this.auxSN2TextBox.Location = new System.Drawing.Point(262, 83);
|
||||
this.auxSN2TextBox.Name = "auxSN2TextBox";
|
||||
this.auxSN2TextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.auxSN2TextBox.TabIndex = 3;
|
||||
this.checkBox2.Visible = false;
|
||||
//
|
||||
// auxSN2Label
|
||||
//
|
||||
@ -172,13 +205,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
this.auxSN2Label.Size = new System.Drawing.Size(193, 23);
|
||||
this.auxSN2Label.TabIndex = 2;
|
||||
this.auxSN2Label.Text = "Aux. WM Serial Nr.";
|
||||
//
|
||||
// mainSN2TextBox
|
||||
//
|
||||
this.mainSN2TextBox.Location = new System.Drawing.Point(262, 37);
|
||||
this.mainSN2TextBox.Name = "mainSN2TextBox";
|
||||
this.mainSN2TextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.mainSN2TextBox.TabIndex = 1;
|
||||
this.auxSN2Label.Visible = false;
|
||||
//
|
||||
// mainSN2Label
|
||||
//
|
||||
@ -188,13 +215,14 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
this.mainSN2Label.Size = new System.Drawing.Size(195, 23);
|
||||
this.mainSN2Label.TabIndex = 0;
|
||||
this.mainSN2Label.Text = "Main WM Serial Nr.";
|
||||
this.mainSN2Label.Visible = false;
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.aux3ComboBox);
|
||||
this.groupBox3.Controls.Add(this.main3ComboBox);
|
||||
this.groupBox3.Controls.Add(this.checkBox3);
|
||||
this.groupBox3.Controls.Add(this.auxSN3TextBox);
|
||||
this.groupBox3.Controls.Add(this.auxSN3Label);
|
||||
this.groupBox3.Controls.Add(this.mainSN3TextBox);
|
||||
this.groupBox3.Controls.Add(this.mainSN3Label);
|
||||
this.groupBox3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.groupBox3.ForeColor = System.Drawing.Color.Black;
|
||||
@ -204,24 +232,43 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
this.groupBox3.TabIndex = 3;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Water Meter 3";
|
||||
this.groupBox3.Visible = false;
|
||||
//
|
||||
// aux3ComboBox
|
||||
//
|
||||
this.aux3ComboBox.FormattingEnabled = true;
|
||||
this.aux3ComboBox.Location = new System.Drawing.Point(262, 83);
|
||||
this.aux3ComboBox.Name = "aux3ComboBox";
|
||||
this.aux3ComboBox.Size = new System.Drawing.Size(200, 31);
|
||||
this.aux3ComboBox.TabIndex = 10;
|
||||
this.aux3ComboBox.Visible = false;
|
||||
this.aux3ComboBox.SelectedIndexChanged += new System.EventHandler(this.aux3ComboBox_SelectedIndexChanged);
|
||||
this.aux3ComboBox.TextChanged += new System.EventHandler(this.aux3ComboBox_TextChanged);
|
||||
this.aux3ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.aux3ComboBox_KeyPress);
|
||||
//
|
||||
// main3ComboBox
|
||||
//
|
||||
this.main3ComboBox.FormattingEnabled = true;
|
||||
this.main3ComboBox.Location = new System.Drawing.Point(262, 37);
|
||||
this.main3ComboBox.Name = "main3ComboBox";
|
||||
this.main3ComboBox.Size = new System.Drawing.Size(200, 31);
|
||||
this.main3ComboBox.TabIndex = 9;
|
||||
this.main3ComboBox.Visible = false;
|
||||
this.main3ComboBox.SelectedIndexChanged += new System.EventHandler(this.main3ComboBox_SelectedIndexChanged);
|
||||
this.main3ComboBox.TextChanged += new System.EventHandler(this.main3ComboBox_TextChanged);
|
||||
this.main3ComboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.main3ComboBox_KeyPress);
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
this.checkBox3.AutoSize = true;
|
||||
this.checkBox3.Font = new System.Drawing.Font("Verdana", 27.75F);
|
||||
this.checkBox3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.checkBox3.Location = new System.Drawing.Point(472, 68);
|
||||
this.checkBox3.Location = new System.Drawing.Point(490, 68);
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.Size = new System.Drawing.Size(15, 14);
|
||||
this.checkBox3.TabIndex = 8;
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// auxSN3TextBox
|
||||
//
|
||||
this.auxSN3TextBox.Location = new System.Drawing.Point(262, 83);
|
||||
this.auxSN3TextBox.Name = "auxSN3TextBox";
|
||||
this.auxSN3TextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.auxSN3TextBox.TabIndex = 3;
|
||||
this.checkBox3.Visible = false;
|
||||
//
|
||||
// auxSN3Label
|
||||
//
|
||||
@ -231,13 +278,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
this.auxSN3Label.Size = new System.Drawing.Size(193, 23);
|
||||
this.auxSN3Label.TabIndex = 2;
|
||||
this.auxSN3Label.Text = "Aux. WM Serial Nr.";
|
||||
//
|
||||
// mainSN3TextBox
|
||||
//
|
||||
this.mainSN3TextBox.Location = new System.Drawing.Point(262, 37);
|
||||
this.mainSN3TextBox.Name = "mainSN3TextBox";
|
||||
this.mainSN3TextBox.Size = new System.Drawing.Size(163, 31);
|
||||
this.mainSN3TextBox.TabIndex = 1;
|
||||
this.auxSN3Label.Visible = false;
|
||||
//
|
||||
// mainSN3Label
|
||||
//
|
||||
@ -247,6 +288,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
this.mainSN3Label.Size = new System.Drawing.Size(195, 23);
|
||||
this.mainSN3Label.TabIndex = 0;
|
||||
this.mainSN3Label.Text = "Main WM Serial Nr.";
|
||||
this.mainSN3Label.Visible = false;
|
||||
//
|
||||
// clearButton
|
||||
//
|
||||
@ -278,7 +320,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
this.orderComboBox.FormattingEnabled = true;
|
||||
this.orderComboBox.Location = new System.Drawing.Point(165, 30);
|
||||
this.orderComboBox.Name = "orderComboBox";
|
||||
this.orderComboBox.Size = new System.Drawing.Size(260, 31);
|
||||
this.orderComboBox.Size = new System.Drawing.Size(297, 31);
|
||||
this.orderComboBox.TabIndex = 0;
|
||||
//
|
||||
// CycleBeginningForm
|
||||
@ -316,18 +358,12 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label mainSN1Label;
|
||||
private System.Windows.Forms.TextBox mainSN1TextBox;
|
||||
private System.Windows.Forms.TextBox auxSN1TextBox;
|
||||
private System.Windows.Forms.Label auxSN1Label;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.TextBox auxSN2TextBox;
|
||||
private System.Windows.Forms.Label auxSN2Label;
|
||||
private System.Windows.Forms.TextBox mainSN2TextBox;
|
||||
private System.Windows.Forms.Label mainSN2Label;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.TextBox auxSN3TextBox;
|
||||
private System.Windows.Forms.Label auxSN3Label;
|
||||
private System.Windows.Forms.TextBox mainSN3TextBox;
|
||||
private System.Windows.Forms.Label mainSN3Label;
|
||||
private System.Windows.Forms.Button clearButton;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
@ -335,5 +371,11 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
private System.Windows.Forms.CheckBox checkBox3;
|
||||
private System.Windows.Forms.GroupBox orderGroupBox;
|
||||
private System.Windows.Forms.ComboBox orderComboBox;
|
||||
private System.Windows.Forms.ComboBox aux1ComboBox;
|
||||
private System.Windows.Forms.ComboBox main1ComboBox;
|
||||
private System.Windows.Forms.ComboBox aux2ComboBox;
|
||||
private System.Windows.Forms.ComboBox main2ComboBox;
|
||||
private System.Windows.Forms.ComboBox aux3ComboBox;
|
||||
private System.Windows.Forms.ComboBox main3ComboBox;
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
@ -14,6 +15,9 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public string PurchaseOrder;
|
||||
public string[] MainSNText;
|
||||
@ -24,20 +28,59 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
private readonly int cmbndWMsCount;
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
int TextBoxesCount;
|
||||
Label[] mainLabels;
|
||||
Label[] auxLabels;
|
||||
ComboBox[] mainComboBoxes;
|
||||
ComboBox[] auxComboBoxes;
|
||||
CheckBox[] checkBoxes;
|
||||
IList<ComboBox> enabledComboBoxes;
|
||||
|
||||
|
||||
public CycleBeginningForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
MainSNText = new string[Program.WMsCount / 2];
|
||||
AuxSNText = new string[Program.WMsCount / 2];
|
||||
TextBoxesCount = 3;
|
||||
mainLabels = new Label[] { mainSN1Label, mainSN2Label, mainSN3Label };
|
||||
auxLabels = new Label[] { auxSN1Label, auxSN2Label, auxSN3Label };
|
||||
mainComboBoxes = new ComboBox[] { main1ComboBox, main2ComboBox, main3ComboBox };
|
||||
auxComboBoxes = new ComboBox[] { aux1ComboBox, aux2ComboBox, aux3ComboBox };
|
||||
checkBoxes = new CheckBox[] { checkBox1, checkBox2, checkBox3 };
|
||||
enabledComboBoxes = new List<ComboBox>();
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
cmbndWMsCount = Program.WMsCount / 2;
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleBeginningForm(int waterMetersCount)
|
||||
: this()
|
||||
{
|
||||
this.WaterMetersCount = waterMetersCount; /// = Program.WMsCount / 2
|
||||
MainSNText = new string[waterMetersCount];
|
||||
AuxSNText = new string[waterMetersCount];
|
||||
Disabled = new bool[waterMetersCount];
|
||||
|
||||
Height = 145 + cmbndWMsCount * 155;
|
||||
ShuffleTextBoxes();
|
||||
|
||||
//Height = 147 + WaterMetersCount * 90;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
/// </summary>
|
||||
void ShuffleTextBoxes()
|
||||
{
|
||||
if (Program.WMsCount / 2 < TextBoxesCount)
|
||||
{
|
||||
TextBoxesCount = Program.WMsCount / 2;
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleBeginningForm_Load(object sender, EventArgs e)
|
||||
@ -46,9 +89,21 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
|
||||
PrepareOrderCombo(orderComboBox);
|
||||
|
||||
if (cmbndWMsCount < 1) groupBox1.Visible = false;
|
||||
if (cmbndWMsCount < 2) groupBox2.Visible = false;
|
||||
if (cmbndWMsCount < 3) groupBox3.Visible = false;
|
||||
TextBoxesCount = Math.Min(TextBoxesCount, WaterMetersCount);
|
||||
|
||||
if (WaterMetersCount >= 1) groupBox1.Visible = true;
|
||||
if (WaterMetersCount >= 2) groupBox2.Visible = true;
|
||||
if (WaterMetersCount >= 3) groupBox3.Visible = true;
|
||||
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
mainComboBoxes[i].Items.Add(Program.LocalSettings.LastMainSNTexts[i]);
|
||||
mainLabels[i].Visible = mainComboBoxes[i].Visible = true;
|
||||
auxLabels[i].Visible = auxComboBoxes[i].Visible = true;
|
||||
checkBoxes[i].Visible = true;
|
||||
enabledComboBoxes.Add(mainComboBoxes[i]);
|
||||
enabledComboBoxes.Add(auxComboBoxes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
@ -65,6 +120,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
auxSN2Label.Text = Strings.Aux_WM_SerialNr;
|
||||
auxSN3Label.Text = Strings.Aux_WM_SerialNr;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
clearButton.Text = Strings.ClearBtnText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -94,25 +150,14 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
#endif
|
||||
);
|
||||
|
||||
if (cmbndWMsCount >= 1)
|
||||
{
|
||||
MainSNText[0] = mainSN1TextBox.Text;
|
||||
AuxSNText[0] = auxSN1TextBox.Text;
|
||||
Disabled[0] = !checkBox1.Checked;
|
||||
}
|
||||
Program.LocalSettings.LastMainSNTexts = MainSNText;
|
||||
Program.LocalSettings.LastAuxSNTexts = AuxSNText;
|
||||
|
||||
if (cmbndWMsCount >= 2)
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
MainSNText[1] = mainSN2TextBox.Text;
|
||||
AuxSNText[1] = auxSN2TextBox.Text;
|
||||
Disabled[1] = !checkBox2.Checked;
|
||||
}
|
||||
|
||||
if (cmbndWMsCount >= 3)
|
||||
{
|
||||
MainSNText[2] = mainSN3TextBox.Text;
|
||||
AuxSNText[2] = auxSN3TextBox.Text;
|
||||
Disabled[2] = !checkBox3.Checked;
|
||||
MainSNText[i] = mainComboBoxes[i].Text;
|
||||
AuxSNText[i] = auxComboBoxes[i].Text;
|
||||
Disabled[i] = !checkBoxes[i].Checked;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
@ -121,10 +166,87 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
|
||||
private void clearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
mainComboBoxes[i].Text = string.Empty;
|
||||
auxComboBoxes[i].Text = string.Empty;
|
||||
checkBoxes[i].Checked = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// When one combo box is updated using drop-down menu, all combo boxes
|
||||
/// are updated by this function.
|
||||
/// </summary>
|
||||
private void UpdateAllCombos()
|
||||
{
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
mainComboBoxes[i].Text = Program.LocalSettings.LastMainSNTexts[i];
|
||||
auxComboBoxes[i].Text = Program.LocalSettings.LastAuxSNTexts[i];
|
||||
checkBoxes[i].Checked = !string.IsNullOrEmpty(mainComboBoxes[i].Text)
|
||||
|| !string.IsNullOrEmpty(auxComboBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void main1ComboBox_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
|
||||
private void main1ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastMainSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (main1ComboBox.Text.Equals(main1ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
private void aux1ComboBox_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
|
||||
private void aux1ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastAuxSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (aux1ComboBox.Text.Equals(aux1ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
private void main2ComboBox_TextChanged(object sender, EventArgs e) { checkBox2.Checked = true; }
|
||||
private void main2ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastMainSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (main2ComboBox.Text.Equals(main2ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
private void aux2ComboBox_TextChanged(object sender, EventArgs e) { checkBox2.Checked = true; }
|
||||
private void aux2ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastAuxSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (aux2ComboBox.Text.Equals(aux2ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
private void main3ComboBox_TextChanged(object sender, EventArgs e) { checkBox3.Checked = true; }
|
||||
private void main3ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastMainSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (main3ComboBox.Text.Equals(main3ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
private void aux3ComboBox_TextChanged(object sender, EventArgs e) { checkBox3.Checked = true; }
|
||||
private void aux3ComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Program.LocalSettings.LastAuxSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
if (aux3ComboBox.Text.Equals(aux3ComboBox.Items[0])) UpdateAllCombos();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Forced close handling
|
||||
|
||||
public void StartForceCloseHandler()
|
||||
@ -143,5 +265,43 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Process a key press within any enabled text boxe
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, ComboBox currentFocusOwner)
|
||||
{
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Process <enter> key ..... Next text field
|
||||
if (enabledComboBoxes.Count < 2) return; /// There is just one enabled textbox
|
||||
|
||||
for (int i = 0; i < enabledComboBoxes.Count; i++)
|
||||
{
|
||||
if (enabledComboBoxes[i] == currentFocusOwner)
|
||||
{
|
||||
/// Change focus to the next enabled text box
|
||||
enabledComboBoxes[(i + 1) % enabledComboBoxes.Count].Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void main1ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, main1ComboBox); }
|
||||
private void main2ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, main2ComboBox); }
|
||||
private void main3ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, main3ComboBox); }
|
||||
private void aux1ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, aux1ComboBox); }
|
||||
private void aux2ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, aux2ComboBox); }
|
||||
private void aux3ComboBox_KeyPress(object sender, KeyPressEventArgs e) { ProcKeyPress(sender, e, aux3ComboBox); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,6 +127,14 @@ namespace TBF
|
||||
[XmlIgnore]
|
||||
public int LastSNTextsCount { get { return (LastSNTexts != null) ? LastSNTexts.Length : 0; } }
|
||||
|
||||
public string[] LastMainSNTexts;
|
||||
[XmlIgnore]
|
||||
public int LastMainSNTextsCount { get { return (LastMainSNTexts != null) ? LastMainSNTexts.Length : 0; } }
|
||||
|
||||
public string[] LastAuxSNTexts;
|
||||
[XmlIgnore]
|
||||
public int LastAuxSNTextsCount { get { return (LastAuxSNTexts != null) ? LastAuxSNTexts.Length : 0; } }
|
||||
|
||||
/// Purchase order history
|
||||
public string[] PurchaseOrderHistory;
|
||||
[XmlIgnore]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user