Unit selection in DataEntry.Standard24.TestStartEndForm, related changes in TestMethods, ver. 2.27.1802
This commit is contained in:
parent
30c8433cb0
commit
6fd7845d63
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.27.1800.0")]
|
||||
[assembly: AssemblyFileVersion("2.27.1800.0")]
|
||||
[assembly: AssemblyVersion("2.27.1802.0")]
|
||||
[assembly: AssemblyFileVersion("2.27.1802.0")]
|
||||
|
||||
9
TBF/Resources/Strings.Designer.cs
generated
9
TBF/Resources/Strings.Designer.cs
generated
@ -852,6 +852,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Close form keys.
|
||||
/// </summary>
|
||||
internal static string Close_form_keys {
|
||||
get {
|
||||
return ResourceManager.GetString("Close_form_keys", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Close the cover.
|
||||
/// </summary>
|
||||
|
||||
@ -2302,4 +2302,7 @@
|
||||
<data name="Database" xml:space="preserve">
|
||||
<value>Database</value>
|
||||
</data>
|
||||
<data name="Close_form_keys" xml:space="preserve">
|
||||
<value>Close form keys</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -21,6 +21,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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
|
||||
|
||||
Config.Unit volumeUnit;
|
||||
double refVolume;
|
||||
double errLimLo;
|
||||
double errLimHi;
|
||||
@ -75,6 +76,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
wmStartStateStr = new string[TBF.Data.WMsCount];
|
||||
wmEndState = new double[TBF.Data.WMsCount];
|
||||
wmCycleEndState = new string[TBF.Data.WMsCount];
|
||||
volumeUnit = (TBF.Rig.Sequences.ProcessData.BenchInfo != null) ? TBF.Rig.Sequences.ProcessData.BenchInfo.VolumeUnit : Config.Unit.l;
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
@ -135,13 +137,15 @@ 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();
|
||||
}
|
||||
///
|
||||
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();
|
||||
}
|
||||
|
||||
@ -225,6 +229,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))))
|
||||
@ -241,11 +246,13 @@ 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))))
|
||||
{
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
wmStartState[i] = dlg.WMStartState[i];
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -22,15 +24,13 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMStartState;
|
||||
readonly string closeFormKeys;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public readonly string[] WMStartStateStr;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMStartState;
|
||||
public double[] WMEndState;
|
||||
public Unit VolumeUnit;
|
||||
|
||||
bool endStates; /// false=start states, true=end states
|
||||
double refVolume;
|
||||
@ -89,6 +89,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();
|
||||
}
|
||||
@ -98,7 +103,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()
|
||||
{
|
||||
endStates = false;
|
||||
@ -106,12 +111,16 @@ 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>
|
||||
/// Constructor to fill in end states
|
||||
@ -123,7 +132,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()
|
||||
{
|
||||
endStates = true;
|
||||
@ -141,8 +150,12 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMEndState = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
VolumeUnit = initialVolumeUnit;
|
||||
unitComboBox.Text = VolumeUnit.ToDescription();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
@ -171,7 +184,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleEndForm_Load(object sender, EventArgs e)
|
||||
private void TestStartEndForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
@ -228,7 +241,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,9 +249,7 @@ 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;
|
||||
@ -246,35 +257,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 (endStates)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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();
|
||||
@ -317,19 +325,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); }
|
||||
@ -390,11 +405,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')
|
||||
{
|
||||
@ -408,7 +430,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;
|
||||
}
|
||||
@ -473,7 +495,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;
|
||||
}
|
||||
@ -529,5 +551,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 (endStates)
|
||||
{
|
||||
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
@ -738,12 +738,18 @@ namespace TBF.Rig.TestMethods.FixedStart
|
||||
{
|
||||
GenericDevices.IRegReader rr = sensPath.RegisterReaders[i];
|
||||
|
||||
if (rr is Rig.Elde.FixedStartRegisterReader.RegisterReader)
|
||||
(rr as Rig.Elde.FixedStartRegisterReader.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
if (rr is Rig.Elde.FixedStartRegisterReader.RegisterReader)
|
||||
{
|
||||
(rr as Rig.Elde.FixedStartRegisterReader.RegisterReader).BeginWMState = dataEntryCmpnt.WMStartState(i);
|
||||
(rr as Rig.Elde.FixedStartRegisterReader.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
}
|
||||
|
||||
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
|
||||
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
}
|
||||
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
|
||||
{
|
||||
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).BeginWMState = dataEntryCmpnt.WMStartState(i);
|
||||
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dataEntryCmpnt is GenericDevices.IDataEntryForCamera && (dataEntryCmpnt as GenericDevices.IDataEntryForCamera).SaveImages)
|
||||
|
||||
@ -925,11 +925,17 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
{
|
||||
GenericDevices.IRegReader rr = sensPath.RegisterReaders[i];
|
||||
|
||||
if (rr is Rig.Elde.FixedStartRegisterReader.RegisterReader)
|
||||
(rr as Rig.Elde.FixedStartRegisterReader.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
if (rr is Rig.Elde.FixedStartRegisterReader.RegisterReader)
|
||||
{
|
||||
(rr as Rig.Elde.FixedStartRegisterReader.RegisterReader).BeginWMState = dataEntryCmpnt.WMStartState(i);
|
||||
(rr as Rig.Elde.FixedStartRegisterReader.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
}
|
||||
|
||||
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
|
||||
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
|
||||
{
|
||||
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).BeginWMState = dataEntryCmpnt.WMStartState(i);
|
||||
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -659,12 +659,18 @@ namespace TBF.Rig.TestMethods.FixedStartTankCollection
|
||||
{
|
||||
GenericDevices.IRegReader rr = sensPath.RegisterReaders[i];
|
||||
|
||||
if (rr is Rig.Elde.FixedStartRegisterReader.RegisterReader)
|
||||
(rr as Rig.Elde.FixedStartRegisterReader.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
if (rr is Rig.Elde.FixedStartRegisterReader.RegisterReader)
|
||||
{
|
||||
(rr as Rig.Elde.FixedStartRegisterReader.RegisterReader).BeginWMState = dataEntryCmpnt.WMStartState(i);
|
||||
(rr as Rig.Elde.FixedStartRegisterReader.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
}
|
||||
|
||||
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
|
||||
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
}
|
||||
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
|
||||
{
|
||||
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).BeginWMState = dataEntryCmpnt.WMStartState(i);
|
||||
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (dataEntryCmpnt is GenericDevices.IDataEntryForCamera && (dataEntryCmpnt as GenericDevices.IDataEntryForCamera).SaveImages)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user