Clean-up after comparing 2.27 and 3.1 branches, ver. 3.1.1861

This commit is contained in:
Milan Hanajik
2022-01-28 14:43:42 +01:00
parent 2a97a8f584
commit ecc92176f3
25 changed files with 467 additions and 350 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
/// Copyright (c) 2020-2022 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -66,7 +66,6 @@ namespace TBF.Rig.DataEntry.Single
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
log.Warn(this.ToString());
}
public override void Initialize()
@@ -77,6 +76,7 @@ namespace TBF.Rig.DataEntry.Single
wmEndState = new double[TBF.Data.WMsCount];
wmCycleEndState = new string[TBF.Data.WMsCount];
currentOp = CurrentOp.None;
log.FatalFormat("{0} initialized: {1}", Name, this);
}
@@ -66,7 +66,6 @@ namespace TBF.Rig.DataEntry.Standard12
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
log.Warn(this.ToString());
}
public override void Initialize()
@@ -77,6 +76,7 @@ namespace TBF.Rig.DataEntry.Standard12
wmEndState = new double[TBF.Data.WMsCount];
wmCycleEndState = new string[TBF.Data.WMsCount];
currentOp = CurrentOp.None;
log.FatalFormat("{0} initialized: {1}", Name, this);
}
@@ -1,6 +1,7 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using TBF.Rig.Generic;
@@ -19,6 +20,7 @@ namespace TBF.Rig.DataEntry.Standard24
///
public bool EnterSerialNrsAtTheEnd;
public bool ShowCycleEndForm;
public string CloseFormKeys;
/// Private parameterless constructor invoked by all other (public) constructors
EntryFormCfg()
@@ -40,6 +40,7 @@ namespace TBF.Rig.DataEntry.Standard24
{
enterSNsAtTheEndCheckBox.Text = Strings.Enter_SNs_at_the_end;
showEndStateFormCheckBox.Text = Strings.Show_cycle_end_form;
closeKeysLabel.Text = Strings.Close_form_keys;
}
public void Closing()
@@ -53,6 +54,7 @@ namespace TBF.Rig.DataEntry.Standard24
nameTextBox.Text = config.Name;
enterSNsAtTheEndCheckBox.Checked = config.EnterSerialNrsAtTheEnd;
showEndStateFormCheckBox.Checked = config.ShowCycleEndForm;
closeKeysTextBox.Text = config.CloseFormKeys;
}
public void Unlock()
@@ -60,6 +62,7 @@ namespace TBF.Rig.DataEntry.Standard24
nameTextBox.Enabled = true;
enterSNsAtTheEndCheckBox.Enabled = true;
showEndStateFormCheckBox.Enabled = true;
closeKeysTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -77,6 +80,7 @@ namespace TBF.Rig.DataEntry.Standard24
config.Name = nameTextBox.Text;
config.EnterSerialNrsAtTheEnd = enterSNsAtTheEndCheckBox.Checked;
config.ShowCycleEndForm = showEndStateFormCheckBox.Checked;
config.CloseFormKeys = closeKeysTextBox.Text;
return flags;
}
+92 -69
View File
@@ -31,75 +31,96 @@ namespace TBF.Rig.DataEntry.Standard24
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.showEndStateFormCheckBox = new System.Windows.Forms.CheckBox();
this.enterSNsAtTheEndCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(99, 57);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(35, 60);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(96, 33);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// showEndStateFormCheckBox
//
this.showEndStateFormCheckBox.AutoSize = true;
this.showEndStateFormCheckBox.Enabled = false;
this.showEndStateFormCheckBox.Location = new System.Drawing.Point(99, 112);
this.showEndStateFormCheckBox.Name = "showEndStateFormCheckBox";
this.showEndStateFormCheckBox.Size = new System.Drawing.Size(151, 17);
this.showEndStateFormCheckBox.TabIndex = 4;
this.showEndStateFormCheckBox.Text = "Watermeter end state form";
this.showEndStateFormCheckBox.UseVisualStyleBackColor = true;
//
// enterSNsAtTheEndCheckBox
//
this.enterSNsAtTheEndCheckBox.AutoSize = true;
this.enterSNsAtTheEndCheckBox.Enabled = false;
this.enterSNsAtTheEndCheckBox.Location = new System.Drawing.Point(99, 89);
this.enterSNsAtTheEndCheckBox.Name = "enterSNsAtTheEndCheckBox";
this.enterSNsAtTheEndCheckBox.Size = new System.Drawing.Size(167, 17);
this.enterSNsAtTheEndCheckBox.TabIndex = 3;
this.enterSNsAtTheEndCheckBox.Text = "Enter serial number at the end";
this.enterSNsAtTheEndCheckBox.UseVisualStyleBackColor = true;
//
// EntryFormCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.enterSNsAtTheEndCheckBox);
this.Controls.Add(this.showEndStateFormCheckBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "EntryFormCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.showEndStateFormCheckBox = new System.Windows.Forms.CheckBox();
this.enterSNsAtTheEndCheckBox = new System.Windows.Forms.CheckBox();
this.closeKeysTextBox = new System.Windows.Forms.TextBox();
this.closeKeysLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(113, 57);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(24, 60);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(110, 33);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// showEndStateFormCheckBox
//
this.showEndStateFormCheckBox.AutoSize = true;
this.showEndStateFormCheckBox.Enabled = false;
this.showEndStateFormCheckBox.Location = new System.Drawing.Point(113, 112);
this.showEndStateFormCheckBox.Name = "showEndStateFormCheckBox";
this.showEndStateFormCheckBox.Size = new System.Drawing.Size(151, 17);
this.showEndStateFormCheckBox.TabIndex = 4;
this.showEndStateFormCheckBox.Text = "Watermeter end state form";
this.showEndStateFormCheckBox.UseVisualStyleBackColor = true;
//
// enterSNsAtTheEndCheckBox
//
this.enterSNsAtTheEndCheckBox.AutoSize = true;
this.enterSNsAtTheEndCheckBox.Enabled = false;
this.enterSNsAtTheEndCheckBox.Location = new System.Drawing.Point(113, 89);
this.enterSNsAtTheEndCheckBox.Name = "enterSNsAtTheEndCheckBox";
this.enterSNsAtTheEndCheckBox.Size = new System.Drawing.Size(167, 17);
this.enterSNsAtTheEndCheckBox.TabIndex = 3;
this.enterSNsAtTheEndCheckBox.Text = "Enter serial number at the end";
this.enterSNsAtTheEndCheckBox.UseVisualStyleBackColor = true;
//
// closeKeysTextBox
//
this.closeKeysTextBox.Enabled = false;
this.closeKeysTextBox.Location = new System.Drawing.Point(113, 142);
this.closeKeysTextBox.Name = "closeKeysTextBox";
this.closeKeysTextBox.Size = new System.Drawing.Size(36, 20);
this.closeKeysTextBox.TabIndex = 6;
//
// closeKeysLabel
//
this.closeKeysLabel.AutoSize = true;
this.closeKeysLabel.Location = new System.Drawing.Point(24, 145);
this.closeKeysLabel.Name = "closeKeysLabel";
this.closeKeysLabel.Size = new System.Drawing.Size(81, 13);
this.closeKeysLabel.TabIndex = 5;
this.closeKeysLabel.Text = "Close form keys";
//
// EntryFormCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.closeKeysTextBox);
this.Controls.Add(this.closeKeysLabel);
this.Controls.Add(this.enterSNsAtTheEndCheckBox);
this.Controls.Add(this.showEndStateFormCheckBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "EntryFormCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -110,5 +131,7 @@ namespace TBF.Rig.DataEntry.Standard24
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.CheckBox showEndStateFormCheckBox;
private System.Windows.Forms.CheckBox enterSNsAtTheEndCheckBox;
private System.Windows.Forms.TextBox closeKeysTextBox;
private System.Windows.Forms.Label closeKeysLabel;
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -39,6 +39,7 @@ namespace TBF.Rig.DataEntry.Standard24
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
Common.Unit volumeUnit;
double refVolume;
double errLimLo;
double errLimHi;
@@ -66,7 +67,6 @@ namespace TBF.Rig.DataEntry.Standard24
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
log.Warn(this.ToString());
}
public override void Initialize()
@@ -76,7 +76,9 @@ namespace TBF.Rig.DataEntry.Standard24
wmStartStateStr = new string[TBF.Data.WMsCount];
wmEndState = new double[TBF.Data.WMsCount];
wmEndStateStr = new string[TBF.Data.WMsCount];
volumeUnit = (TBF.Rig.Sequences.ProcessData.BenchInfo != null) ? TBF.Rig.Sequences.ProcessData.BenchInfo.VolumeUnit : Common.Unit.l;
currentOp = CurrentOp.None;
log.FatalFormat("{0} initialized: {1}", Name, this);
}
@@ -150,7 +152,8 @@ namespace TBF.Rig.DataEntry.Standard24
///
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, myRef.disabled);
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, myRef.disabled,
myRef.entryFormCfg.CloseFormKeys, volumeUnit);
modelessDlg.Show();
}
///
@@ -166,7 +169,8 @@ namespace TBF.Rig.DataEntry.Standard24
///
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled,
refVolume, errLimLo, errLimHi, volumeUnit);
modelessDlg.Show();
}
@@ -254,6 +258,7 @@ namespace TBF.Rig.DataEntry.Standard24
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
volumeUnit = dlg.VolumeUnit;
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
@@ -270,6 +275,7 @@ namespace TBF.Rig.DataEntry.Standard24
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
volumeUnit = dlg.VolumeUnit;
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
+113 -53
View File
@@ -5,6 +5,8 @@ using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using Common;
using Config;
using TBF.Rig.GenericDevices;
using TBF.Resources;
@@ -20,7 +22,6 @@ namespace TBF.Rig.DataEntry.Standard24
End,
}
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
// Set to 'true' when the form closes
@@ -31,20 +32,17 @@ namespace TBF.Rig.DataEntry.Standard24
public readonly int WaterMetersCount;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
readonly string closeFormKeys;
// To be retrieved after the form closes
public double[] WMStartState;
// To be retrieved after the form closes
public readonly string[] WMStartStateStr;
// To be retrieved after the form closes
public double[] WMEndState;
// To be retrieved after the form closes
public readonly string[] WMEndStateStr;
Kind kind; /// false=start states, true=end states
public Unit VolumeUnit;
Kind kind; /// false=start states, true=end states
double refVolume;
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
@@ -101,6 +99,11 @@ namespace TBF.Rig.DataEntry.Standard24
activeTextBoxes = new List<TextBox>();
activeWmNrs = new List<int>();
for (Unit u = 0; u < Unit.Count; u++)
{
if (Units.IsVolume(u)) unitComboBox.Items.Add(u.ToDescription());
}
completed = false;
StartForceCloseHandler();
}
@@ -110,7 +113,7 @@ namespace TBF.Rig.DataEntry.Standard24
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled, string closeFormKeys, Unit initialVolumeUnit)
: this()
{
kind = Kind.Start;
@@ -118,11 +121,15 @@ namespace TBF.Rig.DataEntry.Standard24
this.WaterMetersCount = waterMetersCount;
this.regReaders = regReaders;
this.disabled = disabled;
this.closeFormKeys = closeFormKeys;
ShuffleTextBoxes();
WMStartState = new double[waterMetersCount];
WMStartStateStr = new string[waterMetersCount];
VolumeUnit = initialVolumeUnit;
unitComboBox.Text = VolumeUnit.ToDescription();
}
/// <summary>
@@ -158,7 +165,7 @@ namespace TBF.Rig.DataEntry.Standard24
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
double refVolume, double errLimLo, double errLimHi, Unit initialVolumeUnit)
: this()
{
kind = Kind.End;
@@ -176,8 +183,12 @@ namespace TBF.Rig.DataEntry.Standard24
ShuffleTextBoxes();
WMStartState = new double[waterMetersCount];
WMEndState = new double[waterMetersCount];
WMEndStateStr = new string[waterMetersCount];
VolumeUnit = initialVolumeUnit;
unitComboBox.Text = VolumeUnit.ToDescription();
}
/// <summary>
@@ -207,7 +218,7 @@ namespace TBF.Rig.DataEntry.Standard24
}
}
private void CycleEndForm_Load(object sender, EventArgs e)
private void TestStartEndForm_Load(object sender, EventArgs e)
{
Localize();
@@ -269,7 +280,7 @@ namespace TBF.Rig.DataEntry.Standard24
if ((activeTextBoxes.Count > 0) && (activeWmNrs.Count > 0))
{
activeTextBoxes[0].Focus();
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[0] + 1, string.Empty);
largeTextBox.Text = string.Format("{0}: {1}", activeWmNrs[0] + 1, string.Empty);
}
}
@@ -278,8 +289,8 @@ namespace TBF.Rig.DataEntry.Standard24
Text = Strings.Water_Meter_States;
for (int i = 0; i < TextBoxesCount; i++)
{
labels[i].Text = string.Format("{0} {1}", Strings.Water_Meter, i + 1);
}
labels[i].Text = (i + 1).ToString();
}
startLabel.Text = startLabel2.Text = Strings.Start;
endLabel.Text = endLabel2.Text = Strings.End;
okButton.Text = Strings.OkBtnText;
@@ -287,36 +298,32 @@ namespace TBF.Rig.DataEntry.Standard24
private void okButton_Click(object sender, EventArgs eArgs)
{
try
{
for (int i = 0; i < Math.Min(WaterMetersCount, TextBoxesCount); i++)
{
double startVol, endVol;
if (kind == Kind.End)
{
for (int i = 0; i < Math.Min(WaterMetersCount, TextBoxesCount); i++)
if (endTextBoxes[i].Visible &&
endTextBoxes[i].Enabled &&
Utils.TryParseUDouble(startTextBoxes[i].Text, out startVol) &&
Utils.TryParseUDouble(endTextBoxes[i].Text, out endVol))
{
if (endTextBoxes[i].Visible && endTextBoxes[i].Enabled)
{
WMEndStateStr[i] = endTextBoxes[i].Text;
WMEndState[i] = Utils.ParseUDouble(endTextBoxes[i].Text);
}
WMStartState[i] = Units.ConvertFrom(VolumeUnit, startVol);
WMEndState[i] = Units.ConvertFrom(VolumeUnit, endVol);
}
}
else
{
for (int i = 0; i < Math.Min(WaterMetersCount, TextBoxesCount); i++)
{
if (startTextBoxes[i].Visible && startTextBoxes[i].Enabled)
{
WMStartStateStr[i] = startTextBoxes[i].Text;
WMStartState[i] = Utils.ParseUDouble(startTextBoxes[i].Text);
}
if (startTextBoxes[i].Visible &&
startTextBoxes[i].Enabled &&
Utils.TryParseUDouble(startTextBoxes[i].Text, out startVol))
{
WMStartStateStr[i] = startTextBoxes[i].Text;
WMStartState[i] = Units.ConvertFrom(VolumeUnit, startVol);
}
}
}
catch(Exception e)
{
log.ErrorFormat("Exception: {0}", e.Message);
return;
}
completed = true;
Close();
@@ -359,19 +366,26 @@ namespace TBF.Rig.DataEntry.Standard24
}
}
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBoxes[wmIx].Text);
double startState = Utils.ParseUDouble(startTextBoxes[wmIx].Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
if (wmIx < 0 || wmIx >= TextBoxesCount) return;
bool errorOoR = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
exclamations[wmIx].Visible = errorOoR;
largeExclamationLabel.Visible = errorOoR;
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, wmIx + 1, endTextBoxes[wmIx].Text);
double startVol, endVol;
if (Utils.TryParseUDouble(startTextBoxes[wmIx].Text, out startVol) &&
Utils.TryParseUDouble(endTextBoxes[wmIx].Text, out endVol))
{
double startState = Units.ConvertFrom(VolumeUnit, startVol);
double endState = Units.ConvertFrom(VolumeUnit, endVol);
double err = (refVolume != 0) ? 100.0 * (endState - startState - refVolume) / refVolume : 1000.0;
largeExclamationLabel.Visible =
exclamations[wmIx].Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
else
{
largeExclamationLabel.Visible =
exclamations[wmIx].Visible = !string.IsNullOrEmpty(endTextBoxes[wmIx].Text);
}
largeTextBox.Text = string.Format("{0}: {1}", wmIx + 1, endTextBoxes[wmIx].Text);
}
private void endTextBox1_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox1); }
@@ -432,11 +446,18 @@ namespace TBF.Rig.DataEntry.Standard24
/// <param name="currentFocusOwner">TextBox control which received the event</param>
private void ProcKeyPress(object sender, KeyPressEventArgs e, TextBox currentFocusOwner)
{
if (e.KeyChar == '+')
{
/// Process '+' key ..... Form completed
okButton_Click(sender, e);
}
if (!string.IsNullOrEmpty(closeFormKeys))
{
/// Close the form if any 'close form key' was pressed
for (int ix = 0; ix < closeFormKeys.Length; ix++)
{
if (e.KeyChar == closeFormKeys[ix])
{
okButton_Click(sender, e);
return;
}
}
}
if (e.KeyChar == '\r')
{
@@ -450,7 +471,7 @@ namespace TBF.Rig.DataEntry.Standard24
/// Change focus to the next enabled text box
int newTBIdx = (i + 1) % activeTextBoxes.Count;
activeTextBoxes[newTBIdx].Focus();
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[newTBIdx] + 1, activeTextBoxes[newTBIdx].Text);
largeTextBox.Text = string.Format("{0}: {1}", activeWmNrs[newTBIdx] + 1, activeTextBoxes[newTBIdx].Text);
largeExclamationLabel.Visible = false;
return;
}
@@ -515,7 +536,7 @@ namespace TBF.Rig.DataEntry.Standard24
{
if (startTextBoxes[i] == startTBox)
{
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, i + 1, startTextBoxes[i].Text);
largeTextBox.Text = string.Format("{0}: {1}", i + 1, startTextBoxes[i].Text);
largeExclamationLabel.Visible = false;
break;
}
@@ -571,5 +592,44 @@ namespace TBF.Rig.DataEntry.Standard24
private void startTextBox22_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox22); }
private void startTextBox23_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox23); }
private void startTextBox24_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox24); }
private void unitComboBox_TextChanged(object sender, EventArgs e)
{
unitComboBox_SelectedIndexChanged(sender, e);
}
private void unitComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
var newUnit = Units.FromDescription(unitComboBox.Text);
if (Units.IsVolume(newUnit))
{
VolumeUnit = newUnit;
if (kind == Kind.End)
{
for (int i = 0; i < TextBoxesCount; i++)
{
double startVol, endVol;
if (Utils.TryParseUDouble(startTextBoxes[i].Text, out startVol) &&
Utils.TryParseUDouble(endTextBoxes[i].Text, out endVol))
{
double startState = Units.ConvertFrom(VolumeUnit, startVol);
double endState = Units.ConvertFrom(VolumeUnit, endVol);
double err = (refVolume != 0) ? 100.0 * (endState - startState - refVolume) / refVolume : 1000.0;
exclamations[i].Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
else
{
exclamations[i].Visible = !string.IsNullOrEmpty(endTextBoxes[i].Text);
}
}
largeTextBox.Text = string.Empty;
largeExclamationLabel.Visible = false;
}
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -66,7 +66,6 @@ namespace TBF.Rig.DataEntry.Standard48
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
log.Warn(this.ToString());
}
public override void Initialize()
@@ -77,6 +76,7 @@ namespace TBF.Rig.DataEntry.Standard48
wmEndState = new double[TBF.Data.WMsCount];
wmCycleEndState = new string[TBF.Data.WMsCount];
currentOp = CurrentOp.None;
log.FatalFormat("{0} initialized: {1}", Name, this);
}
@@ -63,7 +63,6 @@ namespace TBF.Rig.DataEntry.Standard6
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
log.Warn(this.ToString());
}
public override void Initialize()
@@ -73,6 +72,7 @@ namespace TBF.Rig.DataEntry.Standard6
wmStartStateStr = new string[TBF.Data.WMsCount];
wmEndState = new double[TBF.Data.WMsCount];
currentOp = CurrentOp.None;
log.FatalFormat("{0} initialized: {1}", Name, this);
}
@@ -117,7 +117,6 @@ namespace TBF.Rig.DataEntry.StandardCamera
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
log.Warn(this.ToString());
}
public override void Initialize()
@@ -128,6 +127,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
wmEndState = new double[TBF.Data.WMsCount];
wmCycleEndState = new string[TBF.Data.WMsCount];
currentOp = CurrentOp.None;
log.FatalFormat("{0} initialized: {1}", Name, this);
}