97 lines
2.4 KiB
C#
97 lines
2.4 KiB
C#
///
|
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
|
///
|
|
using System;
|
|
using System.Windows.Forms;
|
|
using log4net;
|
|
using TBF.Resources;
|
|
|
|
#pragma warning disable 162 /// Disables 'Unreachable code detected' warning
|
|
|
|
namespace TBF.BenchControl.DataEntry.Combined
|
|
{
|
|
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
|
|
|
|
// To be retrieved after the form closes
|
|
public string[] MainSNText;
|
|
public string[] AuxSNText;
|
|
public bool[] WMExists;
|
|
|
|
// Set to 'true' when the form closes
|
|
public bool Completed { get { return completed; } }
|
|
bool completed;
|
|
|
|
public CycleBeginningForm()
|
|
{
|
|
InitializeComponent();
|
|
|
|
MainSNText = new string[Program.WMsCount / 2];
|
|
AuxSNText = new string[Program.WMsCount / 2];
|
|
completed = false;
|
|
StartForceCloseHandler();
|
|
|
|
if (Program.WMsCount / 2 < 2) Height = 200;
|
|
else if (Program.WMsCount / 2 < 3) Height = 355;
|
|
|
|
Localize();
|
|
}
|
|
|
|
void Localize()
|
|
{
|
|
Text = Strings.Data;
|
|
groupBox1.Text = Strings.Water_Meter + " 1";
|
|
mainSN1Label.Text = Strings.Main_WM_SerialNr;
|
|
auxSN1Label.Text = Strings.Aux_WM_SerialNr;
|
|
groupBox2.Text = Strings.Water_Meter + " 2";
|
|
mainSN2Label.Text = Strings.Main_WM_SerialNr;
|
|
auxSN2Label.Text = Strings.Aux_WM_SerialNr;
|
|
groupBox3.Text = Strings.Water_Meter + " 3";
|
|
mainSN3Label.Text = Strings.Main_WM_SerialNr;
|
|
auxSN3Label.Text = Strings.Aux_WM_SerialNr;
|
|
okButton.Text = Strings.OkBtnText;
|
|
}
|
|
|
|
private void okButton_Click(object sender, EventArgs e)
|
|
{
|
|
MainSNText[0] = mainSN1TextBox.Text;
|
|
AuxSNText[0] = auxSN1TextBox.Text;
|
|
|
|
if (Program.WMsCount / 2 >= 2)
|
|
{
|
|
MainSNText[1] = mainSN2TextBox.Text;
|
|
AuxSNText[1] = auxSN2TextBox.Text;
|
|
}
|
|
|
|
if (Program.WMsCount / 2 >= 3)
|
|
{
|
|
MainSNText[2] = mainSN3TextBox.Text;
|
|
AuxSNText[2] = auxSN3TextBox.Text;
|
|
}
|
|
|
|
completed = true;
|
|
Close();
|
|
}
|
|
|
|
#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);
|
|
};
|
|
}
|
|
|
|
void OnForceClose(object sender, EventArgs args)
|
|
{
|
|
DialogResult = DialogResult.Cancel;
|
|
Close();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|