589 lines
25 KiB
C#
589 lines
25 KiB
C#
|
|
///
|
|||
|
|
/// Copyright (c) 2015 Sensus Metering Systems
|
|||
|
|
///
|
|||
|
|
using System;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using log4net;
|
|||
|
|
using TBF.Resources;
|
|||
|
|
|
|||
|
|
namespace TBF.BenchControl.DataEntry.Standard24
|
|||
|
|
{
|
|||
|
|
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
|
|||
|
|
{
|
|||
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
|
|||
|
|
|
|||
|
|
/// <summary> Number of text boxes for serial numbers </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>
|
|||
|
|
/// Constructor
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
|||
|
|
public CycleBeginningForm(int waterMetersCount)
|
|||
|
|
{
|
|||
|
|
this.WaterMetersCount = waterMetersCount;
|
|||
|
|
InitializeComponent();
|
|||
|
|
SNText = new string[WaterMetersCount];
|
|||
|
|
Disabled = new bool[WaterMetersCount];
|
|||
|
|
completed = false;
|
|||
|
|
StartForceCloseHandler();
|
|||
|
|
|
|||
|
|
//Height = 147 + WaterMetersCount * 90;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary> Parameterless constructor for all watermeters </summary>
|
|||
|
|
public CycleBeginningForm()
|
|||
|
|
: this(Program.WMsCount)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void CycleBeginningForm_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
Localize();
|
|||
|
|
|
|||
|
|
PrepareOrderCombo(orderComboBox);
|
|||
|
|
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (WaterMetersCount >= 1) comboBox1.Items.Add(Program.LocalSettings.LastSNTexts[0]);
|
|||
|
|
if (WaterMetersCount >= 2) comboBox2.Items.Add(Program.LocalSettings.LastSNTexts[1]);
|
|||
|
|
if (WaterMetersCount >= 3) comboBox3.Items.Add(Program.LocalSettings.LastSNTexts[2]);
|
|||
|
|
if (WaterMetersCount >= 4) comboBox4.Items.Add(Program.LocalSettings.LastSNTexts[3]);
|
|||
|
|
if (WaterMetersCount >= 5) comboBox5.Items.Add(Program.LocalSettings.LastSNTexts[4]);
|
|||
|
|
if (WaterMetersCount >= 6) comboBox6.Items.Add(Program.LocalSettings.LastSNTexts[5]);
|
|||
|
|
if (WaterMetersCount >= 7) comboBox3.Items.Add(Program.LocalSettings.LastSNTexts[6]);
|
|||
|
|
if (WaterMetersCount >= 8) comboBox4.Items.Add(Program.LocalSettings.LastSNTexts[7]);
|
|||
|
|
if (WaterMetersCount >= 9) comboBox5.Items.Add(Program.LocalSettings.LastSNTexts[8]);
|
|||
|
|
if (WaterMetersCount >= 10) comboBox6.Items.Add(Program.LocalSettings.LastSNTexts[9]);
|
|||
|
|
if (WaterMetersCount >= 11) comboBox1.Items.Add(Program.LocalSettings.LastSNTexts[10]);
|
|||
|
|
if (WaterMetersCount >= 12) comboBox2.Items.Add(Program.LocalSettings.LastSNTexts[11]);
|
|||
|
|
if (WaterMetersCount >= 13) comboBox3.Items.Add(Program.LocalSettings.LastSNTexts[12]);
|
|||
|
|
if (WaterMetersCount >= 14) comboBox4.Items.Add(Program.LocalSettings.LastSNTexts[13]);
|
|||
|
|
if (WaterMetersCount >= 15) comboBox5.Items.Add(Program.LocalSettings.LastSNTexts[14]);
|
|||
|
|
if (WaterMetersCount >= 16) comboBox6.Items.Add(Program.LocalSettings.LastSNTexts[15]);
|
|||
|
|
if (WaterMetersCount >= 17) comboBox3.Items.Add(Program.LocalSettings.LastSNTexts[16]);
|
|||
|
|
if (WaterMetersCount >= 18) comboBox4.Items.Add(Program.LocalSettings.LastSNTexts[17]);
|
|||
|
|
if (WaterMetersCount >= 19) comboBox5.Items.Add(Program.LocalSettings.LastSNTexts[18]);
|
|||
|
|
if (WaterMetersCount >= 20) comboBox6.Items.Add(Program.LocalSettings.LastSNTexts[19]);
|
|||
|
|
if (WaterMetersCount >= 21) comboBox1.Items.Add(Program.LocalSettings.LastSNTexts[20]);
|
|||
|
|
if (WaterMetersCount >= 22) comboBox2.Items.Add(Program.LocalSettings.LastSNTexts[21]);
|
|||
|
|
if (WaterMetersCount >= 23) comboBox3.Items.Add(Program.LocalSettings.LastSNTexts[22]);
|
|||
|
|
if (WaterMetersCount >= 24) comboBox4.Items.Add(Program.LocalSettings.LastSNTexts[23]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (WaterMetersCount < 1) { label1.Visible = comboBox1.Visible = checkBox1.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 2) { label2.Visible = comboBox2.Visible = checkBox2.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 3) { label3.Visible = comboBox3.Visible = checkBox3.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 4) { label4.Visible = comboBox4.Visible = checkBox4.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 5) { label5.Visible = comboBox5.Visible = checkBox5.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 6) { label6.Visible = comboBox6.Visible = checkBox6.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 7) { label7.Visible = comboBox7.Visible = checkBox7.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 8) { label8.Visible = comboBox8.Visible = checkBox8.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 9) { label9.Visible = comboBox9.Visible = checkBox9.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 10) { label10.Visible = comboBox10.Visible = checkBox10.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 11) { label11.Visible = comboBox11.Visible = checkBox11.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 12) { label12.Visible = comboBox12.Visible = checkBox12.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 13) { label13.Visible = comboBox13.Visible = checkBox13.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 14) { label14.Visible = comboBox14.Visible = checkBox14.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 15) { label15.Visible = comboBox15.Visible = checkBox15.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 16) { label16.Visible = comboBox16.Visible = checkBox16.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 17) { label17.Visible = comboBox17.Visible = checkBox17.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 18) { label18.Visible = comboBox18.Visible = checkBox18.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 19) { label19.Visible = comboBox19.Visible = checkBox19.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 20) { label20.Visible = comboBox20.Visible = checkBox20.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 21) { label21.Visible = comboBox21.Visible = checkBox21.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 22) { label22.Visible = comboBox22.Visible = checkBox22.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 23) { label23.Visible = comboBox23.Visible = checkBox23.Visible = false; }
|
|||
|
|
if (WaterMetersCount < 24) { label24.Visible = comboBox24.Visible = checkBox24.Visible = false; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void Localize()
|
|||
|
|
{
|
|||
|
|
Text = Strings.Data;
|
|||
|
|
orderGroupBox.Text = Strings.Purchase_Order;
|
|||
|
|
label1.Text = Strings.Serial_Number + " 1";
|
|||
|
|
label2.Text = Strings.Serial_Number + " 2";
|
|||
|
|
label3.Text = Strings.Serial_Number + " 3";
|
|||
|
|
label4.Text = Strings.Serial_Number + " 4";
|
|||
|
|
label5.Text = Strings.Serial_Number + " 5";
|
|||
|
|
label6.Text = Strings.Serial_Number + " 6";
|
|||
|
|
label7.Text = Strings.Serial_Number + " 7";
|
|||
|
|
label8.Text = Strings.Serial_Number + " 8";
|
|||
|
|
label9.Text = Strings.Serial_Number + " 9";
|
|||
|
|
label10.Text = Strings.Serial_Number + " 10";
|
|||
|
|
label11.Text = Strings.Serial_Number + " 11";
|
|||
|
|
label12.Text = Strings.Serial_Number + " 12";
|
|||
|
|
label13.Text = Strings.Serial_Number + " 13";
|
|||
|
|
label14.Text = Strings.Serial_Number + " 14";
|
|||
|
|
label15.Text = Strings.Serial_Number + " 15";
|
|||
|
|
label16.Text = Strings.Serial_Number + " 16";
|
|||
|
|
label17.Text = Strings.Serial_Number + " 17";
|
|||
|
|
label18.Text = Strings.Serial_Number + " 18";
|
|||
|
|
label19.Text = Strings.Serial_Number + " 19";
|
|||
|
|
label20.Text = Strings.Serial_Number + " 20";
|
|||
|
|
label21.Text = Strings.Serial_Number + " 21";
|
|||
|
|
label22.Text = Strings.Serial_Number + " 22";
|
|||
|
|
label23.Text = Strings.Serial_Number + " 23";
|
|||
|
|
label24.Text = Strings.Serial_Number + " 24";
|
|||
|
|
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 FUZHOU150 || FUZHOU300
|
|||
|
|
, 20
|
|||
|
|
#endif
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
Program.LocalSettings.LastSNTexts = SNText;
|
|||
|
|
|
|||
|
|
if (WaterMetersCount >= 1) { SNText[0] = comboBox1.Text; Disabled[0] = !checkBox1.Checked; }
|
|||
|
|
if (WaterMetersCount >= 2) { SNText[1] = comboBox2.Text; Disabled[1] = !checkBox2.Checked; }
|
|||
|
|
if (WaterMetersCount >= 3) { SNText[2] = comboBox3.Text; Disabled[2] = !checkBox3.Checked; }
|
|||
|
|
if (WaterMetersCount >= 4) { SNText[3] = comboBox4.Text; Disabled[3] = !checkBox4.Checked; }
|
|||
|
|
if (WaterMetersCount >= 5) { SNText[4] = comboBox5.Text; Disabled[4] = !checkBox5.Checked; }
|
|||
|
|
if (WaterMetersCount >= 6) { SNText[5] = comboBox6.Text; Disabled[5] = !checkBox6.Checked; }
|
|||
|
|
if (WaterMetersCount >= 7) { SNText[6] = comboBox7.Text; Disabled[6] = !checkBox7.Checked; }
|
|||
|
|
if (WaterMetersCount >= 8) { SNText[7] = comboBox8.Text; Disabled[7] = !checkBox8.Checked; }
|
|||
|
|
if (WaterMetersCount >= 9) { SNText[8] = comboBox9.Text; Disabled[8] = !checkBox9.Checked; }
|
|||
|
|
if (WaterMetersCount >= 10) { SNText[9] = comboBox10.Text; Disabled[9] = !checkBox10.Checked; }
|
|||
|
|
if (WaterMetersCount >= 11) { SNText[10] = comboBox11.Text; Disabled[10] = !checkBox11.Checked; }
|
|||
|
|
if (WaterMetersCount >= 12) { SNText[11] = comboBox12.Text; Disabled[11] = !checkBox12.Checked; }
|
|||
|
|
if (WaterMetersCount >= 13) { SNText[12] = comboBox13.Text; Disabled[12] = !checkBox13.Checked; }
|
|||
|
|
if (WaterMetersCount >= 14) { SNText[13] = comboBox14.Text; Disabled[13] = !checkBox14.Checked; }
|
|||
|
|
if (WaterMetersCount >= 15) { SNText[14] = comboBox15.Text; Disabled[14] = !checkBox15.Checked; }
|
|||
|
|
if (WaterMetersCount >= 16) { SNText[15] = comboBox16.Text; Disabled[15] = !checkBox16.Checked; }
|
|||
|
|
if (WaterMetersCount >= 17) { SNText[16] = comboBox17.Text; Disabled[16] = !checkBox17.Checked; }
|
|||
|
|
if (WaterMetersCount >= 18) { SNText[17] = comboBox18.Text; Disabled[17] = !checkBox18.Checked; }
|
|||
|
|
if (WaterMetersCount >= 19) { SNText[18] = comboBox19.Text; Disabled[18] = !checkBox19.Checked; }
|
|||
|
|
if (WaterMetersCount >= 20) { SNText[19] = comboBox20.Text; Disabled[19] = !checkBox20.Checked; }
|
|||
|
|
if (WaterMetersCount >= 21) { SNText[20] = comboBox21.Text; Disabled[20] = !checkBox21.Checked; }
|
|||
|
|
if (WaterMetersCount >= 22) { SNText[21] = comboBox22.Text; Disabled[21] = !checkBox22.Checked; }
|
|||
|
|
if (WaterMetersCount >= 23) { SNText[22] = comboBox23.Text; Disabled[22] = !checkBox23.Checked; }
|
|||
|
|
if (WaterMetersCount >= 24) { SNText[23] = comboBox24.Text; Disabled[23] = !checkBox24.Checked; }
|
|||
|
|
|
|||
|
|
completed = true;
|
|||
|
|
Close();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void UpdateAllCombos()
|
|||
|
|
{
|
|||
|
|
if (WaterMetersCount >= 1)
|
|||
|
|
{
|
|||
|
|
comboBox1.Text = Program.LocalSettings.LastSNTexts[0];
|
|||
|
|
checkBox1.Checked = !string.IsNullOrEmpty(comboBox1.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 2)
|
|||
|
|
{
|
|||
|
|
comboBox2.Text = Program.LocalSettings.LastSNTexts[1];
|
|||
|
|
checkBox2.Checked = !string.IsNullOrEmpty(comboBox2.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 3)
|
|||
|
|
{
|
|||
|
|
comboBox3.Text = Program.LocalSettings.LastSNTexts[2];
|
|||
|
|
checkBox3.Checked = !string.IsNullOrEmpty(comboBox3.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 4)
|
|||
|
|
{
|
|||
|
|
comboBox4.Text = Program.LocalSettings.LastSNTexts[3];
|
|||
|
|
checkBox4.Checked = !string.IsNullOrEmpty(comboBox4.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 5)
|
|||
|
|
{
|
|||
|
|
comboBox5.Text = Program.LocalSettings.LastSNTexts[4];
|
|||
|
|
checkBox5.Checked = !string.IsNullOrEmpty(comboBox5.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 6)
|
|||
|
|
{
|
|||
|
|
comboBox6.Text = Program.LocalSettings.LastSNTexts[5];
|
|||
|
|
checkBox6.Checked = !string.IsNullOrEmpty(comboBox6.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 7)
|
|||
|
|
{
|
|||
|
|
comboBox7.Text = Program.LocalSettings.LastSNTexts[6];
|
|||
|
|
checkBox7.Checked = !string.IsNullOrEmpty(comboBox7.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 8)
|
|||
|
|
{
|
|||
|
|
comboBox8.Text = Program.LocalSettings.LastSNTexts[7];
|
|||
|
|
checkBox8.Checked = !string.IsNullOrEmpty(comboBox8.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 9)
|
|||
|
|
{
|
|||
|
|
comboBox9.Text = Program.LocalSettings.LastSNTexts[8];
|
|||
|
|
checkBox9.Checked = !string.IsNullOrEmpty(comboBox9.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 10)
|
|||
|
|
{
|
|||
|
|
comboBox10.Text = Program.LocalSettings.LastSNTexts[9];
|
|||
|
|
checkBox10.Checked = !string.IsNullOrEmpty(comboBox10.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 11)
|
|||
|
|
{
|
|||
|
|
comboBox11.Text = Program.LocalSettings.LastSNTexts[10];
|
|||
|
|
checkBox11.Checked = !string.IsNullOrEmpty(comboBox11.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 12)
|
|||
|
|
{
|
|||
|
|
comboBox12.Text = Program.LocalSettings.LastSNTexts[11];
|
|||
|
|
checkBox12.Checked = !string.IsNullOrEmpty(comboBox12.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 13)
|
|||
|
|
{
|
|||
|
|
comboBox13.Text = Program.LocalSettings.LastSNTexts[12];
|
|||
|
|
checkBox13.Checked = !string.IsNullOrEmpty(comboBox13.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 14)
|
|||
|
|
{
|
|||
|
|
comboBox14.Text = Program.LocalSettings.LastSNTexts[13];
|
|||
|
|
checkBox14.Checked = !string.IsNullOrEmpty(comboBox14.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 15)
|
|||
|
|
{
|
|||
|
|
comboBox15.Text = Program.LocalSettings.LastSNTexts[14];
|
|||
|
|
checkBox15.Checked = !string.IsNullOrEmpty(comboBox15.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 16)
|
|||
|
|
{
|
|||
|
|
comboBox16.Text = Program.LocalSettings.LastSNTexts[15];
|
|||
|
|
checkBox16.Checked = !string.IsNullOrEmpty(comboBox16.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 17)
|
|||
|
|
{
|
|||
|
|
comboBox17.Text = Program.LocalSettings.LastSNTexts[16];
|
|||
|
|
checkBox17.Checked = !string.IsNullOrEmpty(comboBox17.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 18)
|
|||
|
|
{
|
|||
|
|
comboBox18.Text = Program.LocalSettings.LastSNTexts[17];
|
|||
|
|
checkBox18.Checked = !string.IsNullOrEmpty(comboBox18.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 19)
|
|||
|
|
{
|
|||
|
|
comboBox19.Text = Program.LocalSettings.LastSNTexts[18];
|
|||
|
|
checkBox19.Checked = !string.IsNullOrEmpty(comboBox19.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 20)
|
|||
|
|
{
|
|||
|
|
comboBox20.Text = Program.LocalSettings.LastSNTexts[19];
|
|||
|
|
checkBox20.Checked = !string.IsNullOrEmpty(comboBox20.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 21)
|
|||
|
|
{
|
|||
|
|
comboBox21.Text = Program.LocalSettings.LastSNTexts[20];
|
|||
|
|
checkBox21.Checked = !string.IsNullOrEmpty(comboBox21.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 22)
|
|||
|
|
{
|
|||
|
|
comboBox22.Text = Program.LocalSettings.LastSNTexts[21];
|
|||
|
|
checkBox22.Checked = !string.IsNullOrEmpty(comboBox22.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 23)
|
|||
|
|
{
|
|||
|
|
comboBox23.Text = Program.LocalSettings.LastSNTexts[22];
|
|||
|
|
checkBox23.Checked = !string.IsNullOrEmpty(comboBox23.Text);
|
|||
|
|
}
|
|||
|
|
if (WaterMetersCount >= 24)
|
|||
|
|
{
|
|||
|
|
comboBox24.Text = Program.LocalSettings.LastSNTexts[23];
|
|||
|
|
checkBox24.Checked = !string.IsNullOrEmpty(comboBox24.Text);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void clearButton_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (WaterMetersCount >= 1) { comboBox1.Text = string.Empty; checkBox1.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 2) { comboBox2.Text = string.Empty; checkBox2.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 3) { comboBox3.Text = string.Empty; checkBox3.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 4) { comboBox4.Text = string.Empty; checkBox4.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 5) { comboBox5.Text = string.Empty; checkBox5.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 6) { comboBox6.Text = string.Empty; checkBox6.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 7) { comboBox7.Text = string.Empty; checkBox7.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 8) { comboBox8.Text = string.Empty; checkBox8.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 9) { comboBox9.Text = string.Empty; checkBox9.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 10) { comboBox10.Text = string.Empty; checkBox10.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 11) { comboBox11.Text = string.Empty; checkBox11.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 12) { comboBox12.Text = string.Empty; checkBox12.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 13) { comboBox13.Text = string.Empty; checkBox13.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 14) { comboBox14.Text = string.Empty; checkBox14.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 15) { comboBox15.Text = string.Empty; checkBox15.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 16) { comboBox16.Text = string.Empty; checkBox16.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 17) { comboBox17.Text = string.Empty; checkBox17.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 18) { comboBox18.Text = string.Empty; checkBox18.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 19) { comboBox19.Text = string.Empty; checkBox19.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 20) { comboBox20.Text = string.Empty; checkBox20.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 21) { comboBox21.Text = string.Empty; checkBox21.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 22) { comboBox22.Text = string.Empty; checkBox22.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 23) { comboBox23.Text = string.Empty; checkBox23.Checked = false; }
|
|||
|
|
if (WaterMetersCount >= 24) { comboBox24.Text = string.Empty; checkBox24.Checked = false; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void comboBox1_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
|
|||
|
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox1.Text.Equals(Program.LocalSettings.LastSNTexts[0])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox2_TextChanged(object sender, EventArgs e) { checkBox2.Checked = true; }
|
|||
|
|
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox2.Text.Equals(Program.LocalSettings.LastSNTexts[1])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox3_TextChanged(object sender, EventArgs e) { checkBox3.Checked = true; }
|
|||
|
|
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox3.Text.Equals(Program.LocalSettings.LastSNTexts[2])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox4_TextChanged(object sender, EventArgs e) { checkBox4.Checked = true; }
|
|||
|
|
private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox4.Text.Equals(Program.LocalSettings.LastSNTexts[3])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox5_TextChanged(object sender, EventArgs e) { checkBox5.Checked = true; }
|
|||
|
|
private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox5.Text.Equals(Program.LocalSettings.LastSNTexts[4])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox6_TextChanged(object sender, EventArgs e) { checkBox6.Checked = true; }
|
|||
|
|
private void comboBox6_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox6.Text.Equals(Program.LocalSettings.LastSNTexts[5])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox7_TextChanged(object sender, EventArgs e) { checkBox7.Checked = true; }
|
|||
|
|
private void comboBox7_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox7.Text.Equals(Program.LocalSettings.LastSNTexts[6])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox8_TextChanged(object sender, EventArgs e) { checkBox8.Checked = true; }
|
|||
|
|
private void comboBox8_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox8.Text.Equals(Program.LocalSettings.LastSNTexts[7])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox9_TextChanged(object sender, EventArgs e) { checkBox9.Checked = true; }
|
|||
|
|
private void comboBox9_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox9.Text.Equals(Program.LocalSettings.LastSNTexts[8])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox10_TextChanged(object sender, EventArgs e) { checkBox10.Checked = true; }
|
|||
|
|
private void comboBox10_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox10.Text.Equals(Program.LocalSettings.LastSNTexts[9])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox11_TextChanged(object sender, EventArgs e) { checkBox11.Checked = true; }
|
|||
|
|
private void comboBox11_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox11.Text.Equals(Program.LocalSettings.LastSNTexts[10])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox12_TextChanged(object sender, EventArgs e) { checkBox12.Checked = true; }
|
|||
|
|
private void comboBox12_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox12.Text.Equals(Program.LocalSettings.LastSNTexts[11])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox13_TextChanged(object sender, EventArgs e) { checkBox13.Checked = true; }
|
|||
|
|
private void comboBox13_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox13.Text.Equals(Program.LocalSettings.LastSNTexts[12])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox14_TextChanged(object sender, EventArgs e) { checkBox14.Checked = true; }
|
|||
|
|
private void comboBox14_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox14.Text.Equals(Program.LocalSettings.LastSNTexts[13])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox15_TextChanged(object sender, EventArgs e) { checkBox15.Checked = true; }
|
|||
|
|
private void comboBox15_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox15.Text.Equals(Program.LocalSettings.LastSNTexts[14])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox16_TextChanged(object sender, EventArgs e) { checkBox16.Checked = true; }
|
|||
|
|
private void comboBox16_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox16.Text.Equals(Program.LocalSettings.LastSNTexts[15])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox17_TextChanged(object sender, EventArgs e) { checkBox17.Checked = true; }
|
|||
|
|
private void comboBox17_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox17.Text.Equals(Program.LocalSettings.LastSNTexts[16])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox18_TextChanged(object sender, EventArgs e) { checkBox18.Checked = true; }
|
|||
|
|
private void comboBox18_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox18.Text.Equals(Program.LocalSettings.LastSNTexts[17])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox19_TextChanged(object sender, EventArgs e) { checkBox19.Checked = true; }
|
|||
|
|
private void comboBox19_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox19.Text.Equals(Program.LocalSettings.LastSNTexts[18])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox20_TextChanged(object sender, EventArgs e) { checkBox20.Checked = true; }
|
|||
|
|
private void comboBox20_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox20.Text.Equals(Program.LocalSettings.LastSNTexts[19])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox21_TextChanged(object sender, EventArgs e) { checkBox21.Checked = true; }
|
|||
|
|
private void comboBox21_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox21.Text.Equals(Program.LocalSettings.LastSNTexts[20])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox22_TextChanged(object sender, EventArgs e) { checkBox22.Checked = true; }
|
|||
|
|
private void comboBox22_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox22.Text.Equals(Program.LocalSettings.LastSNTexts[21])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox23_TextChanged(object sender, EventArgs e) { checkBox23.Checked = true; }
|
|||
|
|
private void comboBox23_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox23.Text.Equals(Program.LocalSettings.LastSNTexts[22])) UpdateAllCombos();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox24_TextChanged(object sender, EventArgs e) { checkBox24.Checked = true; }
|
|||
|
|
private void comboBox24_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
|||
|
|
{
|
|||
|
|
if (comboBox24.Text.Equals(Program.LocalSettings.LastSNTexts[23])) 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
|
|||
|
|
}
|
|||
|
|
}
|