740 lines
29 KiB
C#
740 lines
29 KiB
C#
|
|
///
|
|||
|
|
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
|||
|
|
///
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using log4net;
|
|||
|
|
using TBF.Resources;
|
|||
|
|
|
|||
|
|
namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio
|
|||
|
|
{
|
|||
|
|
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
|
|||
|
|
{
|
|||
|
|
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 is closed
|
|||
|
|
public string PurchaseOrder;
|
|||
|
|
public string[] SNText;
|
|||
|
|
public bool[] Disabled;
|
|||
|
|
|
|||
|
|
/// Set to 'true' when the form closes
|
|||
|
|
public bool Completed { get { return completed; } }
|
|||
|
|
bool completed;
|
|||
|
|
|
|||
|
|
/// <summary> Number of text boxes for serial numbers </summary>
|
|||
|
|
int textBoxesCount;
|
|||
|
|
Label[] labels;
|
|||
|
|
ComboBox[] comboBoxes;
|
|||
|
|
CheckBox[] checkBoxes;
|
|||
|
|
IList<ComboBox> enabledComboBoxes;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary> Parameterless constructor for common functionality </summary>
|
|||
|
|
public CycleBeginningForm()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
ControlBox = false;
|
|||
|
|
|
|||
|
|
textBoxesCount = 48;
|
|||
|
|
labels = new Label[]
|
|||
|
|
{
|
|||
|
|
label1, label2, label3, label4, label5, label6, label7, label8, label9, label10,
|
|||
|
|
label11, label12, label13, label14, label15, label16, label17, label18, label19, label20,
|
|||
|
|
label21, label22, label23, label24, label25, label26, label27, label28, label29, label30,
|
|||
|
|
label31, label32, label33, label34, label35, label36, label37, label38, label39, label40,
|
|||
|
|
label41, label42, label43, label44, label45, label46, label47, label48,
|
|||
|
|
};
|
|||
|
|
comboBoxes = new ComboBox[]
|
|||
|
|
{
|
|||
|
|
comboBox1, comboBox2, comboBox3, comboBox4, comboBox5, comboBox6, comboBox7, comboBox8, comboBox9, comboBox10,
|
|||
|
|
comboBox11, comboBox12, comboBox13, comboBox14, comboBox15, comboBox16, comboBox17, comboBox18, comboBox19, comboBox20,
|
|||
|
|
comboBox21, comboBox22, comboBox23, comboBox24, comboBox25, comboBox26, comboBox27, comboBox28, comboBox29, comboBox30,
|
|||
|
|
comboBox31, comboBox32, comboBox33, comboBox34, comboBox35, comboBox36, comboBox37, comboBox38, comboBox39, comboBox40,
|
|||
|
|
comboBox41, comboBox42, comboBox43, comboBox44, comboBox45, comboBox46, comboBox47, comboBox48,
|
|||
|
|
};
|
|||
|
|
checkBoxes = new CheckBox[]
|
|||
|
|
{
|
|||
|
|
checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6, checkBox7, checkBox8, checkBox9, checkBox10,
|
|||
|
|
checkBox11, checkBox12, checkBox13, checkBox14, checkBox15, checkBox16, checkBox17, checkBox18, checkBox19, checkBox20,
|
|||
|
|
checkBox21, checkBox22, checkBox23, checkBox24, checkBox25, checkBox26, checkBox27, checkBox28, checkBox29, checkBox30,
|
|||
|
|
checkBox31, checkBox32, checkBox33, checkBox34, checkBox35, checkBox36, checkBox37, checkBox38, checkBox39, checkBox40,
|
|||
|
|
checkBox41, checkBox42, checkBox43, checkBox44, checkBox45, checkBox46, checkBox47, checkBox48,
|
|||
|
|
};
|
|||
|
|
enabledComboBoxes = new List<ComboBox>();
|
|||
|
|
|
|||
|
|
completed = false;
|
|||
|
|
StartForceCloseHandler();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Constructor
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
|||
|
|
public CycleBeginningForm(int waterMetersCount)
|
|||
|
|
: this()
|
|||
|
|
{
|
|||
|
|
this.WaterMetersCount = waterMetersCount;
|
|||
|
|
SNText = new string[WaterMetersCount];
|
|||
|
|
Disabled = new bool[WaterMetersCount];
|
|||
|
|
|
|||
|
|
ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize);
|
|||
|
|
|
|||
|
|
//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>
|
|||
|
|
/// <param name="wmsCount">Number of watermeters</param>
|
|||
|
|
/// <param name="lineSize">Number of watermeters in one line</param>
|
|||
|
|
void ShuffleTextBoxes(int wmsCount, int lineSize)
|
|||
|
|
{
|
|||
|
|
if (wmsCount < textBoxesCount && lineSize > 0)
|
|||
|
|
{
|
|||
|
|
int nrLines = (wmsCount + lineSize - 1) / lineSize;
|
|||
|
|
int gap = (textBoxesCount - wmsCount) / nrLines;
|
|||
|
|
|
|||
|
|
int dest = 0;
|
|||
|
|
for (int l = 0; l < nrLines; l++)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < lineSize; i++)
|
|||
|
|
{
|
|||
|
|
labels[dest] = labels[l * lineSize + l * gap + i];
|
|||
|
|
comboBoxes[dest] = comboBoxes[l * lineSize + l * gap + i];
|
|||
|
|
checkBoxes[dest] = checkBoxes[l * lineSize + l * gap + i];
|
|||
|
|
dest++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
textBoxesCount = wmsCount;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void CycleBeginningForm_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
Localize();
|
|||
|
|
|
|||
|
|
PrepareOrderCombo(orderComboBox);
|
|||
|
|
|
|||
|
|
for (int i = 0; i < textBoxesCount; i++)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == textBoxesCount)
|
|||
|
|
{
|
|||
|
|
comboBoxes[i].Items.Add((Program.LocalSettings.LastSNTexts[i] == null) ? string.Empty : Program.LocalSettings.LastSNTexts[i]);
|
|||
|
|
}
|
|||
|
|
labels[i].Visible = comboBoxes[i].Visible = checkBoxes[i].Visible = true;
|
|||
|
|
enabledComboBoxes.Add(comboBoxes[i]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void Localize()
|
|||
|
|
{
|
|||
|
|
Text = Strings.Data;
|
|||
|
|
orderGroupBox.Text = Strings.Purchase_order;
|
|||
|
|
for (int i = 0; i < textBoxesCount; i++)
|
|||
|
|
{
|
|||
|
|
labels[i].Text = Strings.Serial_Number + " " + (i + 1).ToString();
|
|||
|
|
}
|
|||
|
|
okButton.Text = Strings.OkBtnText;
|
|||
|
|
clearButton.Text = Strings.ClearBtnText;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="orderComboBox">Puchase order ComboBox</param>
|
|||
|
|
void PrepareOrderCombo(ComboBox orderComboBox)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < Program.LocalSettings.PurchaseOrderHistoryCount; i++)
|
|||
|
|
{
|
|||
|
|
orderComboBox.Items.Add(Program.LocalSettings.PurchaseOrderHistory[i]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (orderComboBox.Items.Count > 0)
|
|||
|
|
{
|
|||
|
|
orderComboBox.Text = orderComboBox.Items[0].ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void okButton_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
PurchaseOrder = orderComboBox.Text;
|
|||
|
|
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
|
|||
|
|
ref Program.LocalSettings.PurchaseOrderHistory
|
|||
|
|
#if FUZHOU_150 || FUZHOU_300
|
|||
|
|
, 20
|
|||
|
|
#endif
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
Program.LocalSettings.LastSNTexts = SNText;
|
|||
|
|
|
|||
|
|
for (int i = 0; i < Math.Min(WaterMetersCount, textBoxesCount); i++)
|
|||
|
|
{
|
|||
|
|
SNText[i] = comboBoxes[i].Text;
|
|||
|
|
Disabled[i] = !checkBoxes[i].Checked;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
completed = true;
|
|||
|
|
Close();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <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 < Math.Min(WaterMetersCount, textBoxesCount); i++)
|
|||
|
|
{
|
|||
|
|
comboBoxes[i].Text = Program.LocalSettings.LastSNTexts[i];
|
|||
|
|
checkBoxes[i].Checked = !string.IsNullOrEmpty(comboBoxes[i].Text);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void clearButton_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < Math.Min(WaterMetersCount, textBoxesCount); i++)
|
|||
|
|
{
|
|||
|
|
comboBoxes[i].Text = string.Empty;
|
|||
|
|
checkBoxes[i].Checked = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void comboBox1_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
|
|||
|
|
private void comboBox2_TextChanged(object sender, EventArgs e) { checkBox2.Checked = true; }
|
|||
|
|
private void comboBox3_TextChanged(object sender, EventArgs e) { checkBox3.Checked = true; }
|
|||
|
|
private void comboBox4_TextChanged(object sender, EventArgs e) { checkBox4.Checked = true; }
|
|||
|
|
private void comboBox5_TextChanged(object sender, EventArgs e) { checkBox5.Checked = true; }
|
|||
|
|
private void comboBox6_TextChanged(object sender, EventArgs e) { checkBox6.Checked = true; }
|
|||
|
|
private void comboBox7_TextChanged(object sender, EventArgs e) { checkBox7.Checked = true; }
|
|||
|
|
private void comboBox8_TextChanged(object sender, EventArgs e) { checkBox8.Checked = true; }
|
|||
|
|
private void comboBox9_TextChanged(object sender, EventArgs e) { checkBox9.Checked = true; }
|
|||
|
|
private void comboBox10_TextChanged(object sender, EventArgs e) { checkBox10.Checked = true; }
|
|||
|
|
private void comboBox11_TextChanged(object sender, EventArgs e) { checkBox11.Checked = true; }
|
|||
|
|
private void comboBox12_TextChanged(object sender, EventArgs e) { checkBox12.Checked = true; }
|
|||
|
|
private void comboBox13_TextChanged(object sender, EventArgs e) { checkBox13.Checked = true; }
|
|||
|
|
private void comboBox14_TextChanged(object sender, EventArgs e) { checkBox14.Checked = true; }
|
|||
|
|
private void comboBox15_TextChanged(object sender, EventArgs e) { checkBox15.Checked = true; }
|
|||
|
|
private void comboBox16_TextChanged(object sender, EventArgs e) { checkBox16.Checked = true; }
|
|||
|
|
private void comboBox17_TextChanged(object sender, EventArgs e) { checkBox17.Checked = true; }
|
|||
|
|
private void comboBox18_TextChanged(object sender, EventArgs e) { checkBox18.Checked = true; }
|
|||
|
|
private void comboBox19_TextChanged(object sender, EventArgs e) { checkBox19.Checked = true; }
|
|||
|
|
private void comboBox20_TextChanged(object sender, EventArgs e) { checkBox20.Checked = true; }
|
|||
|
|
private void comboBox21_TextChanged(object sender, EventArgs e) { checkBox21.Checked = true; }
|
|||
|
|
private void comboBox22_TextChanged(object sender, EventArgs e) { checkBox22.Checked = true; }
|
|||
|
|
private void comboBox23_TextChanged(object sender, EventArgs e) { checkBox23.Checked = true; }
|
|||
|
|
private void comboBox24_TextChanged(object sender, EventArgs e) { checkBox24.Checked = true; }
|
|||
|
|
private void comboBox25_TextChanged(object sender, EventArgs e) { checkBox25.Checked = true; }
|
|||
|
|
private void comboBox26_TextChanged(object sender, EventArgs e) { checkBox26.Checked = true; }
|
|||
|
|
private void comboBox27_TextChanged(object sender, EventArgs e) { checkBox27.Checked = true; }
|
|||
|
|
private void comboBox28_TextChanged(object sender, EventArgs e) { checkBox28.Checked = true; }
|
|||
|
|
private void comboBox29_TextChanged(object sender, EventArgs e) { checkBox29.Checked = true; }
|
|||
|
|
private void comboBox30_TextChanged(object sender, EventArgs e) { checkBox30.Checked = true; }
|
|||
|
|
private void comboBox31_TextChanged(object sender, EventArgs e) { checkBox31.Checked = true; }
|
|||
|
|
private void comboBox32_TextChanged(object sender, EventArgs e) { checkBox32.Checked = true; }
|
|||
|
|
private void comboBox33_TextChanged(object sender, EventArgs e) { checkBox33.Checked = true; }
|
|||
|
|
private void comboBox34_TextChanged(object sender, EventArgs e) { checkBox34.Checked = true; }
|
|||
|
|
private void comboBox35_TextChanged(object sender, EventArgs e) { checkBox35.Checked = true; }
|
|||
|
|
private void comboBox36_TextChanged(object sender, EventArgs e) { checkBox36.Checked = true; }
|
|||
|
|
private void comboBox37_TextChanged(object sender, EventArgs e) { checkBox37.Checked = true; }
|
|||
|
|
private void comboBox38_TextChanged(object sender, EventArgs e) { checkBox38.Checked = true; }
|
|||
|
|
private void comboBox39_TextChanged(object sender, EventArgs e) { checkBox39.Checked = true; }
|
|||
|
|
private void comboBox40_TextChanged(object sender, EventArgs e) { checkBox40.Checked = true; }
|
|||
|
|
private void comboBox41_TextChanged(object sender, EventArgs e) { checkBox41.Checked = true; }
|
|||
|
|
private void comboBox42_TextChanged(object sender, EventArgs e) { checkBox42.Checked = true; }
|
|||
|
|
private void comboBox43_TextChanged(object sender, EventArgs e) { checkBox43.Checked = true; }
|
|||
|
|
private void comboBox44_TextChanged(object sender, EventArgs e) { checkBox44.Checked = true; }
|
|||
|
|
private void comboBox45_TextChanged(object sender, EventArgs e) { checkBox45.Checked = true; }
|
|||
|
|
private void comboBox46_TextChanged(object sender, EventArgs e) { checkBox46.Checked = true; }
|
|||
|
|
private void comboBox47_TextChanged(object sender, EventArgs e) { checkBox47.Checked = true; }
|
|||
|
|
private void comboBox48_TextChanged(object sender, EventArgs e) { checkBox48.Checked = true; }
|
|||
|
|
|
|||
|
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox1.Text.Equals(comboBox1.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox2.Text.Equals(comboBox2.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox3.Text.Equals(comboBox3.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox4.Text.Equals(comboBox4.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox5.Text.Equals(comboBox5.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox6_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox6.Text.Equals(comboBox6.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox7_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox7.Text.Equals(comboBox7.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox8_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox8.Text.Equals(comboBox8.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox9_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox9.Text.Equals(comboBox9.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox10_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox10.Text.Equals(comboBox10.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox11_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox11.Text.Equals(comboBox11.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox12_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox12.Text.Equals(comboBox12.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox13_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox13.Text.Equals(comboBox13.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox14_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox14.Text.Equals(comboBox14.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox15_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox15.Text.Equals(comboBox15.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox16_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox16.Text.Equals(comboBox16.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox17_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox17.Text.Equals(comboBox17.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox18_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox18.Text.Equals(comboBox18.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox19_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox19.Text.Equals(comboBox19.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox20_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox20.Text.Equals(comboBox20.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox21_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox21.Text.Equals(comboBox21.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox22_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox22.Text.Equals(comboBox22.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox23_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox23.Text.Equals(comboBox23.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox24_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox24.Text.Equals(comboBox24.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox25_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox25.Text.Equals(comboBox25.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox26_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox26.Text.Equals(comboBox26.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox27_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox27.Text.Equals(comboBox27.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox28_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox28.Text.Equals(comboBox28.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox29_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox29.Text.Equals(comboBox29.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox30_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox30.Text.Equals(comboBox30.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox31_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox31.Text.Equals(comboBox31.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox32_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox32.Text.Equals(comboBox32.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox33_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox33.Text.Equals(comboBox33.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox34_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox34.Text.Equals(comboBox34.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox35_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox35.Text.Equals(comboBox35.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox36_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox36.Text.Equals(comboBox36.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox37_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox37.Text.Equals(comboBox37.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox38_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox38.Text.Equals(comboBox38.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox39_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox39.Text.Equals(comboBox39.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox40_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox40.Text.Equals(comboBox40.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox41_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox41.Text.Equals(comboBox41.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox42_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox42.Text.Equals(comboBox42.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox43_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox43.Text.Equals(comboBox43.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox44_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox44.Text.Equals(comboBox44.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox45_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox45.Text.Equals(comboBox45.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox46_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox46.Text.Equals(comboBox46.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox47_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox47.Text.Equals(comboBox47.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox48_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox48.Text.Equals(comboBox48.Items[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region Forced close handling
|
|||
|
|
|
|||
|
|
public void StartForceCloseHandler()
|
|||
|
|
{
|
|||
|
|
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
|
|||
|
|
{
|
|||
|
|
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
|
|||
|
|
else OnForceClose(sender, args);
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void OnForceClose(object sender, EventArgs args)
|
|||
|
|
{
|
|||
|
|
DialogResult = DialogResult.Cancel;
|
|||
|
|
Close();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#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 comboBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox1); }
|
|||
|
|
private void comboBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox2); }
|
|||
|
|
private void comboBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox3); }
|
|||
|
|
private void comboBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox4); }
|
|||
|
|
private void comboBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox5); }
|
|||
|
|
private void comboBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox6); }
|
|||
|
|
private void comboBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox7); }
|
|||
|
|
private void comboBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox8); }
|
|||
|
|
private void comboBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox9); }
|
|||
|
|
private void comboBox10_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox10); }
|
|||
|
|
private void comboBox11_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox11); }
|
|||
|
|
private void comboBox12_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox12); }
|
|||
|
|
private void comboBox13_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox13); }
|
|||
|
|
private void comboBox14_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox14); }
|
|||
|
|
private void comboBox15_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox15); }
|
|||
|
|
private void comboBox16_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox16); }
|
|||
|
|
private void comboBox17_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox17); }
|
|||
|
|
private void comboBox18_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox18); }
|
|||
|
|
private void comboBox19_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox19); }
|
|||
|
|
private void comboBox20_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox20); }
|
|||
|
|
private void comboBox21_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox21); }
|
|||
|
|
private void comboBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox22); }
|
|||
|
|
private void comboBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox23); }
|
|||
|
|
private void comboBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox24); }
|
|||
|
|
private void comboBox25_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox25); }
|
|||
|
|
private void comboBox26_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox26); }
|
|||
|
|
private void comboBox27_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox27); }
|
|||
|
|
private void comboBox28_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox28); }
|
|||
|
|
private void comboBox29_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox29); }
|
|||
|
|
private void comboBox30_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox30); }
|
|||
|
|
private void comboBox31_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox31); }
|
|||
|
|
private void comboBox32_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox32); }
|
|||
|
|
private void comboBox33_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox33); }
|
|||
|
|
private void comboBox34_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox34); }
|
|||
|
|
private void comboBox35_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox35); }
|
|||
|
|
private void comboBox36_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox36); }
|
|||
|
|
private void comboBox37_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox37); }
|
|||
|
|
private void comboBox38_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox38); }
|
|||
|
|
private void comboBox39_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox39); }
|
|||
|
|
private void comboBox40_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox40); }
|
|||
|
|
private void comboBox41_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox41); }
|
|||
|
|
private void comboBox42_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox42); }
|
|||
|
|
private void comboBox43_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox43); }
|
|||
|
|
private void comboBox44_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox44); }
|
|||
|
|
private void comboBox45_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox45); }
|
|||
|
|
private void comboBox46_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox46); }
|
|||
|
|
private void comboBox47_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox47); }
|
|||
|
|
private void comboBox48_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox48); }
|
|||
|
|
}
|
|||
|
|
}
|