DataEntry.Standard supports IHasWMStatesForm interface. Fixed start method should work without register readers (test!).

This commit is contained in:
Milan Hanajik
2015-04-14 07:14:45 +02:00
parent 1698a923bf
commit 274ab79cb7
10 changed files with 609 additions and 65 deletions
@@ -37,6 +37,12 @@ namespace TBF.BenchControl.DataEntry.Standard
Height = 147 + WaterMetersCount * 90; Height = 147 + WaterMetersCount * 90;
} }
/// <summary> Parameterless constructor for all watermeters </summary>
public CycleBeginningForm()
: this(Program.WMsCount)
{
}
private void CycleBeginningForm_Load(object sender, EventArgs e) private void CycleBeginningForm_Load(object sender, EventArgs e)
{ {
Localize(); Localize();
@@ -6,7 +6,7 @@ using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Standard namespace TBF.BenchControl.DataEntry.Standard
{ {
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
{ {
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm)); private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
public override string ToString() { return string.Format("DataEntry.Standard({0})", Cfg.ToString(1)); } public override string ToString() { return string.Format("DataEntry.Standard({0})", Cfg.ToString(1)); }
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.DataEntry.Standard
readonly EntryFormCfg entryFormCfg; readonly EntryFormCfg entryFormCfg;
/// <summary> /// <summary>
/// Properties set by the Begin and the End form /// Properties set by the Begin, End and WMStates form
/// </summary> /// </summary>
string purchaseOrder; string purchaseOrder;
public string PurchaseOrder { get { return purchaseOrder; } } public string PurchaseOrder { get { return purchaseOrder; } }
@@ -28,12 +28,8 @@ namespace TBF.BenchControl.DataEntry.Standard
string[] wmEndState; string[] wmEndState;
public string WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : string.Empty; } public string WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : string.Empty; }
public float WMState(int wmNr) float[] wmState;
{ public float WMState(int wmNr) { return (wmNr >= 0 && wmNr < wmState.Length) ? wmState[wmNr] : 0; }
float retVal;
if (wmNr >= 0 && wmNr < wmEndState.Length && Utils.TryParseUFloat(wmEndState[wmNr], out retVal)) return retVal;
return 0;
}
System.Windows.Forms.Form modelessDlg; System.Windows.Forms.Form modelessDlg;
@@ -47,6 +43,7 @@ namespace TBF.BenchControl.DataEntry.Standard
None, None,
ShowFormAtCycleBeginning, ShowFormAtCycleBeginning,
ShowFormAtCycleEnd, ShowFormAtCycleEnd,
EnterWMStates,
} }
CurrentOp currentOp; CurrentOp currentOp;
@@ -58,6 +55,7 @@ namespace TBF.BenchControl.DataEntry.Standard
serialNr = new string[Program.WMsCount]; serialNr = new string[Program.WMsCount];
disabled = new bool[Program.WMsCount]; disabled = new bool[Program.WMsCount];
wmEndState = new string[Program.WMsCount]; wmEndState = new string[Program.WMsCount];
wmState = new float[Program.WMsCount];
entryFormCfg = cfg; entryFormCfg = cfg;
currentOp = CurrentOp.None; currentOp = CurrentOp.None;
@@ -85,8 +83,10 @@ namespace TBF.BenchControl.DataEntry.Standard
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowWMSNsAndStatesFormOp() public IOperation ShowWMSNsAndStatesFormOp()
{ {
return null; if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
} currentOp = CurrentOp.EnterWMStates;
return this;
}
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowWMStatesFormOp() public IOperation ShowWMStatesFormOp()
@@ -107,6 +107,12 @@ namespace TBF.BenchControl.DataEntry.Standard
myRef.modelessDlg = new CycleEndForm(Program.WMsCount); myRef.modelessDlg = new CycleEndForm(Program.WMsCount);
modelessDlg.Show(); modelessDlg.Show();
} }
///
void OpenWMStatesDlg(EntryForm myRef)
{
myRef.modelessDlg = new WMStatesForm(Program.WMsCount);
modelessDlg.Show();
}
/// <summary>Start this operation</summary> /// <summary>Start this operation</summary>
public void Start() public void Start()
@@ -120,7 +126,10 @@ namespace TBF.BenchControl.DataEntry.Standard
case CurrentOp.ShowFormAtCycleEnd: case CurrentOp.ShowFormAtCycleEnd:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this); Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
break; break;
} case CurrentOp.EnterWMStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenWMStatesDlg), this);
break;
}
} }
/// <summary>Run this operation</summary> /// <summary>Run this operation</summary>
@@ -161,6 +170,15 @@ namespace TBF.BenchControl.DataEntry.Standard
} }
} }
} }
else if (modelessDlg is WMStatesForm)
{
WMStatesForm dlg = (modelessDlg as WMStatesForm);
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmState[i] = dlg.WMState[i];
}
}
resultSaved = true; resultSaved = true;
modelessDlg = null; modelessDlg = null;
} }
@@ -0,0 +1,112 @@
using System;
using System.Windows.Forms;
using log4net;
using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Standard
{
public partial class WMStatesForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(WMStatesForm));
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
// To be retrieved after the form closes
public float[] WMState;
// 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 WMStatesForm(int waterMetersCount)
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
WMState = new float[WaterMetersCount];
completed = false;
StartForceCloseHandler();
}
/// <summary> Parameterless constructor for all watermeters </summary>
public WMStatesForm()
: this(Program.WMsCount)
{
}
private void CycleEndForm_Load(object sender, EventArgs e)
{
Localize();
Height = 195 + 90 * WaterMetersCount;
if (WaterMetersCount < 1) groupBox1.Visible = false;
if (WaterMetersCount < 2) groupBox2.Visible = false;
if (WaterMetersCount < 3) groupBox3.Visible = false;
if (WaterMetersCount < 4) groupBox4.Visible = false;
if (WaterMetersCount < 5) groupBox5.Visible = false;
if (WaterMetersCount < 6) groupBox6.Visible = false;
}
void Localize()
{
Text = Strings.Water_Meter_States;
groupBox1.Text = Strings.Water_Meter + " 1";
groupBox2.Text = Strings.Water_Meter + " 2";
groupBox3.Text = Strings.Water_Meter + " 3";
groupBox4.Text = Strings.Water_Meter + " 4";
groupBox5.Text = Strings.Water_Meter + " 5";
groupBox6.Text = Strings.Water_Meter + " 6";
wmStateLabel1.Text = Strings.WMState;
wmStateLabel2.Text = Strings.WMState;
wmStateLabel3.Text = Strings.WMState;
wmStateLabel4.Text = Strings.WMState;
wmStateLabel5.Text = Strings.WMState;
wmStateLabel6.Text = Strings.WMState;
okButton.Text = Strings.OkBtnText;
}
private void okButton_Click(object sender, EventArgs e)
{
try
{
if (WaterMetersCount >= 1) WMState[0] = Utils.ParseUFloat(wmStateTextBox1.Text);
if (WaterMetersCount >= 2) WMState[1] = Utils.ParseUFloat(wmStateTextBox2.Text);
if (WaterMetersCount >= 3) WMState[2] = Utils.ParseUFloat(wmStateTextBox3.Text);
if (WaterMetersCount >= 4) WMState[3] = Utils.ParseUFloat(wmStateTextBox4.Text);
if (WaterMetersCount >= 5) WMState[4] = Utils.ParseUFloat(wmStateTextBox5.Text);
if (WaterMetersCount >= 6) WMState[5] = Utils.ParseUFloat(wmStateTextBox6.Text);
}
catch
{
return;
}
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
}
}
@@ -0,0 +1,302 @@
namespace TBF.BenchControl.DataEntry.Standard
{
partial class WMStatesForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.wmStateTextBox2 = new System.Windows.Forms.TextBox();
this.wmStateLabel2 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.wmStateTextBox1 = new System.Windows.Forms.TextBox();
this.wmStateLabel1 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.wmStateTextBox3 = new System.Windows.Forms.TextBox();
this.wmStateLabel3 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.wmStateTextBox4 = new System.Windows.Forms.TextBox();
this.wmStateLabel4 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.wmStateTextBox5 = new System.Windows.Forms.TextBox();
this.wmStateLabel5 = new System.Windows.Forms.Label();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.wmStateTextBox6 = new System.Windows.Forms.TextBox();
this.wmStateLabel6 = new System.Windows.Forms.Label();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox6.SuspendLayout();
this.SuspendLayout();
//
// groupBox2
//
this.groupBox2.Controls.Add(this.wmStateTextBox2);
this.groupBox2.Controls.Add(this.wmStateLabel2);
this.groupBox2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox2.ForeColor = System.Drawing.Color.Black;
this.groupBox2.Location = new System.Drawing.Point(25, 102);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(362, 81);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Water Meter 2";
//
// wmStateTextBox2
//
this.wmStateTextBox2.Location = new System.Drawing.Point(183, 31);
this.wmStateTextBox2.Name = "wmStateTextBox2";
this.wmStateTextBox2.Size = new System.Drawing.Size(163, 31);
this.wmStateTextBox2.TabIndex = 1;
//
// wmStateLabel2
//
this.wmStateLabel2.AutoSize = true;
this.wmStateLabel2.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel2.Name = "wmStateLabel2";
this.wmStateLabel2.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel2.TabIndex = 0;
this.wmStateLabel2.Text = "State:";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.wmStateTextBox1);
this.groupBox1.Controls.Add(this.wmStateLabel1);
this.groupBox1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox1.ForeColor = System.Drawing.Color.Black;
this.groupBox1.Location = new System.Drawing.Point(25, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(362, 81);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Water Meter 1";
//
// wmStateTextBox1
//
this.wmStateTextBox1.Location = new System.Drawing.Point(183, 31);
this.wmStateTextBox1.Name = "wmStateTextBox1";
this.wmStateTextBox1.Size = new System.Drawing.Size(163, 31);
this.wmStateTextBox1.TabIndex = 1;
//
// wmStateLabel1
//
this.wmStateLabel1.AutoSize = true;
this.wmStateLabel1.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel1.Name = "wmStateLabel1";
this.wmStateLabel1.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel1.TabIndex = 0;
this.wmStateLabel1.Text = "State:";
//
// okButton
//
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(425, 21);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(98, 63);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.wmStateTextBox3);
this.groupBox3.Controls.Add(this.wmStateLabel3);
this.groupBox3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox3.ForeColor = System.Drawing.Color.Black;
this.groupBox3.Location = new System.Drawing.Point(25, 192);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(362, 81);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Water Meter 3";
//
// wmStateTextBox3
//
this.wmStateTextBox3.Location = new System.Drawing.Point(183, 31);
this.wmStateTextBox3.Name = "wmStateTextBox3";
this.wmStateTextBox3.Size = new System.Drawing.Size(163, 31);
this.wmStateTextBox3.TabIndex = 1;
//
// wmStateLabel3
//
this.wmStateLabel3.AutoSize = true;
this.wmStateLabel3.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel3.Name = "wmStateLabel3";
this.wmStateLabel3.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel3.TabIndex = 0;
this.wmStateLabel3.Text = "State:";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.wmStateTextBox4);
this.groupBox4.Controls.Add(this.wmStateLabel4);
this.groupBox4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox4.ForeColor = System.Drawing.Color.Black;
this.groupBox4.Location = new System.Drawing.Point(25, 282);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(362, 81);
this.groupBox4.TabIndex = 4;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Water Meter 4";
//
// wmStateTextBox4
//
this.wmStateTextBox4.Location = new System.Drawing.Point(183, 31);
this.wmStateTextBox4.Name = "wmStateTextBox4";
this.wmStateTextBox4.Size = new System.Drawing.Size(163, 31);
this.wmStateTextBox4.TabIndex = 1;
//
// wmStateLabel4
//
this.wmStateLabel4.AutoSize = true;
this.wmStateLabel4.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel4.Name = "wmStateLabel4";
this.wmStateLabel4.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel4.TabIndex = 0;
this.wmStateLabel4.Text = "State:";
//
// groupBox5
//
this.groupBox5.Controls.Add(this.wmStateTextBox5);
this.groupBox5.Controls.Add(this.wmStateLabel5);
this.groupBox5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox5.ForeColor = System.Drawing.Color.Black;
this.groupBox5.Location = new System.Drawing.Point(25, 372);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(362, 81);
this.groupBox5.TabIndex = 5;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Water Meter 5";
//
// wmStateTextBox5
//
this.wmStateTextBox5.Location = new System.Drawing.Point(183, 31);
this.wmStateTextBox5.Name = "wmStateTextBox5";
this.wmStateTextBox5.Size = new System.Drawing.Size(163, 31);
this.wmStateTextBox5.TabIndex = 1;
//
// wmStateLabel5
//
this.wmStateLabel5.AutoSize = true;
this.wmStateLabel5.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel5.Name = "wmStateLabel5";
this.wmStateLabel5.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel5.TabIndex = 0;
this.wmStateLabel5.Text = "State:";
//
// groupBox6
//
this.groupBox6.Controls.Add(this.wmStateTextBox6);
this.groupBox6.Controls.Add(this.wmStateLabel6);
this.groupBox6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox6.ForeColor = System.Drawing.Color.Black;
this.groupBox6.Location = new System.Drawing.Point(25, 462);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(362, 81);
this.groupBox6.TabIndex = 6;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "Water Meter 6";
//
// wmStateTextBox6
//
this.wmStateTextBox6.Location = new System.Drawing.Point(183, 31);
this.wmStateTextBox6.Name = "wmStateTextBox6";
this.wmStateTextBox6.Size = new System.Drawing.Size(163, 31);
this.wmStateTextBox6.TabIndex = 1;
//
// wmStateLabel6
//
this.wmStateLabel6.AutoSize = true;
this.wmStateLabel6.Location = new System.Drawing.Point(18, 34);
this.wmStateLabel6.Name = "wmStateLabel6";
this.wmStateLabel6.Size = new System.Drawing.Size(68, 23);
this.wmStateLabel6.TabIndex = 0;
this.wmStateLabel6.Text = "State:";
//
// CycleEndForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGoldenrod;
this.ClientSize = new System.Drawing.Size(559, 565);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.okButton);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "CycleEndForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "Water Meter States";
this.TopMost = true;
this.Load += new System.EventHandler(this.CycleEndForm_Load);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox wmStateTextBox2;
private System.Windows.Forms.Label wmStateLabel2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox wmStateTextBox1;
private System.Windows.Forms.Label wmStateLabel1;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox wmStateTextBox3;
private System.Windows.Forms.Label wmStateLabel3;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.TextBox wmStateTextBox4;
private System.Windows.Forms.Label wmStateLabel4;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.TextBox wmStateTextBox5;
private System.Windows.Forms.Label wmStateLabel5;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.TextBox wmStateTextBox6;
private System.Windows.Forms.Label wmStateLabel6;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -95,13 +95,13 @@ namespace TBF.BenchControl.DataEntry.WMStates
delegate void EntryFormDlgt(EntryForm myRef); delegate void EntryFormDlgt(EntryForm myRef);
/// ///
void OpenBeginningDlg(EntryForm myRef) void OpenWMSNsAndStatesDlg(EntryForm myRef)
{ {
myRef.modelessDlg = new WMSNsAndStatesForm(Program.WMsCount); myRef.modelessDlg = new WMSNsAndStatesForm(Program.WMsCount);
modelessDlg.Show(); modelessDlg.Show();
} }
/// ///
void OpenEndDlg(EntryForm myRef) void OpenWMStatesDlg(EntryForm myRef)
{ {
myRef.modelessDlg = new WMStatesForm(Program.WMsCount); myRef.modelessDlg = new WMStatesForm(Program.WMsCount);
modelessDlg.Show(); modelessDlg.Show();
@@ -114,10 +114,10 @@ namespace TBF.BenchControl.DataEntry.WMStates
switch (currentOp) switch (currentOp)
{ {
case CurrentOp.EnterWMSNsAndStates: case CurrentOp.EnterWMSNsAndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this); Program.MainWnd.Invoke(new EntryFormDlgt(OpenWMSNsAndStatesDlg), this);
break; break;
case CurrentOp.EnterWMStates: case CurrentOp.EnterWMStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this); Program.MainWnd.Invoke(new EntryFormDlgt(OpenWMStatesDlg), this);
break; break;
} }
} }
@@ -5,46 +5,6 @@ namespace TBF.BenchControl.GenericDevices
{ {
public interface IDataEntry : IComponent public interface IDataEntry : IComponent
{ {
/// <summary>
/// Water meter serial numbers set by forms
/// </summary>
string SerialNr(int wmNr);
/// <summary>
/// Water meter states set by forms
/// </summary>
float WMState(int wmNr);
/// <summary>
/// Displays form at the beginning of the cycle (usually to enter S/N).
/// </summary>
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
/// <returns>Operation to be used in the sequence</returns>
IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters);
/// <summary>
/// Displays form at the end of the cycle (usually to enter the end state).
/// </summary>
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
/// <returns>Operation to be used in the sequence</returns>
IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters);
/// <summary>
/// Displays form at the beginning of the cycle (usually to enter S/N).
/// </summary>
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
/// <returns>Operation to be used in the sequence</returns>
IOperation ShowWMSNsAndStatesFormOp();
/// <summary>
/// Displays form at the beginning of the cycle (usually to enter S/N).
/// </summary>
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
/// <returns>Operation to be used in the sequence</returns>
IOperation ShowWMStatesFormOp();
/// <summary> /// <summary>
/// Updates test results with the information collected in watermeters. /// Updates test results with the information collected in watermeters.
/// </summary> /// </summary>
@@ -3,7 +3,12 @@ namespace TBF.BenchControl.GenericDevices
{ {
public interface IHasWMStatesForm public interface IHasWMStatesForm
{ {
/// <summary> /// <summary>
/// Water meter states set by forms
/// </summary>
float WMState(int wmNr);
/// <summary>
/// Displays form at the beginning of the cycle (usually to enter S/N). /// Displays form at the beginning of the cycle (usually to enter S/N).
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes to be updated by the operation</param> /// <param name="waterMeters">Watermetes to be updated by the operation</param>
@@ -218,9 +218,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// ///
/// Enter watermeter begin states here /// Enter watermeter begin states here
/// ///
GenericDevices.IDataEntry dataEntryCmpnt = GenericDevices.IHasWMStatesForm dataEntryCmpnt =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry; TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
if (dataEntryCmpnt is GenericDevices.IHasWMStatesForm) if (dataEntryCmpnt != null)
{ {
Bridge.OnActivity(this, "Enter the water meter data"); Bridge.OnActivity(this, "Enter the water meter data");
State.Create("FixedStartMassCollection : Enter begin-state") State.Create("FixedStartMassCollection : Enter begin-state")
@@ -244,6 +244,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
registerReader.EndWMState = dataEntryCmpnt.WMState(i); registerReader.EndWMState = dataEntryCmpnt.WMState(i);
tstRslt.Meters[i].VolumeStart = dataEntryCmpnt.WMState(i) / registerReader.PulsesPerLtr; /// liter tstRslt.Meters[i].VolumeStart = dataEntryCmpnt.WMState(i) / registerReader.PulsesPerLtr; /// liter
} }
else
{
tstRslt.Meters[i].VolumeStart = dataEntryCmpnt.WMState(i); /// Units: 1 liter
}
} }
} }
@@ -429,11 +433,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// ///
/// Enter watermeter end states here /// Enter watermeter end states here
/// ///
if (dataEntryCmpnt is GenericDevices.IHasWMStatesForm) if (dataEntryCmpnt != null)
{ {
Bridge.OnActivity(this, "Enter the water meter data"); Bridge.OnActivity(this, "Enter the water meter data");
State.Create("FixedStartMassCollection : Enter end-state") State.Create("FixedStartMassCollection : Enter end-state")
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowWMStatesFormOp()) .AddOperation(dataEntryCmpnt.ShowWMStatesFormOp())
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.EnterState(); .EnterState();
do do
@@ -448,8 +452,16 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
{ {
BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader = BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader =
sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader;
registerReader.EndWMState = dataEntryCmpnt.WMState(i);
tstRslt.Meters[i].VolumeEnd = dataEntryCmpnt.WMState(i) / registerReader.PulsesPerLtr; /// liter if (registerReader != null)
{
registerReader.EndWMState = dataEntryCmpnt.WMState(i);
tstRslt.Meters[i].VolumeEnd = dataEntryCmpnt.WMState(i) / registerReader.PulsesPerLtr; /// liter
}
else
{
tstRslt.Meters[i].VolumeEnd = dataEntryCmpnt.WMState(i);
}
} }
} }
+9
View File
@@ -132,6 +132,12 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BenchControl\DataEntry\Standard\WMStatesForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BenchControl\DataEntry\Standard\WMStatesForm.designer.cs">
<DependentUpon>WMStatesForm.cs</DependentUpon>
</Compile>
<Compile Include="PrintOrderDocument.cs"> <Compile Include="PrintOrderDocument.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
@@ -1137,6 +1143,9 @@
<EmbeddedResource Include="BenchControl\DataEntry\Standard\EntryFormCfgCtrl.resx"> <EmbeddedResource Include="BenchControl\DataEntry\Standard\EntryFormCfgCtrl.resx">
<DependentUpon>EntryFormCfgCtrl.cs</DependentUpon> <DependentUpon>EntryFormCfgCtrl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="BenchControl\DataEntry\Standard\WMStatesForm.resx">
<DependentUpon>WMStatesForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\DataEntry\WMStates\WMSNsAndStatesForm.resx"> <EmbeddedResource Include="BenchControl\DataEntry\WMStates\WMSNsAndStatesForm.resx">
<DependentUpon>WMSNsAndStatesForm.cs</DependentUpon> <DependentUpon>WMSNsAndStatesForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>