From 274ab79cb795d5796285a23990a8f1d0e3d12d60 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Tue, 14 Apr 2015 07:14:45 +0200 Subject: [PATCH] DataEntry.Standard supports IHasWMStatesForm interface. Fixed start method should work without register readers (test!). --- .../DataEntry/Standard/CycleBeginningForm.cs | 6 + .../DataEntry/Standard/EntryForm.cs | 42 ++- .../DataEntry/Standard/WMStatesForm.cs | 112 +++++++ .../Standard/WMStatesForm.designer.cs | 302 ++++++++++++++++++ .../DataEntry/Standard/WMStatesForm.resx | 120 +++++++ .../DataEntry/WMStates/EntryForm.cs | 10 +- .../BenchControl/GenericDevices/IDataEntry.cs | 40 --- .../GenericDevices/IHasWMStatesForm.cs | 7 +- .../FixedStartMassCollectionSeq.cs | 26 +- TestBenchFramework/TBF.csproj | 9 + 10 files changed, 609 insertions(+), 65 deletions(-) create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.designer.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.resx diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.cs index 48078545f..b3820b822 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.cs @@ -37,6 +37,12 @@ namespace TBF.BenchControl.DataEntry.Standard Height = 147 + WaterMetersCount * 90; } + /// Parameterless constructor for all watermeters + public CycleBeginningForm() + : this(Program.WMsCount) + { + } + private void CycleBeginningForm_Load(object sender, EventArgs e) { Localize(); diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs index d757535f1..3c29901ea 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs @@ -6,7 +6,7 @@ using TBF.BenchControl.GenericDevices; 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)); 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; /// - /// Properties set by the Begin and the End form + /// Properties set by the Begin, End and WMStates form /// string purchaseOrder; public string PurchaseOrder { get { return purchaseOrder; } } @@ -28,13 +28,9 @@ namespace TBF.BenchControl.DataEntry.Standard string[] wmEndState; public string WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : string.Empty; } - public float WMState(int wmNr) - { - float retVal; - if (wmNr >= 0 && wmNr < wmEndState.Length && Utils.TryParseUFloat(wmEndState[wmNr], out retVal)) return retVal; - return 0; - } - + float[] wmState; + public float WMState(int wmNr) { return (wmNr >= 0 && wmNr < wmState.Length) ? wmState[wmNr] : 0; } + System.Windows.Forms.Form modelessDlg; @@ -47,6 +43,7 @@ namespace TBF.BenchControl.DataEntry.Standard None, ShowFormAtCycleBeginning, ShowFormAtCycleEnd, + EnterWMStates, } CurrentOp currentOp; @@ -58,6 +55,7 @@ namespace TBF.BenchControl.DataEntry.Standard serialNr = new string[Program.WMsCount]; disabled = new bool[Program.WMsCount]; wmEndState = new string[Program.WMsCount]; + wmState = new float[Program.WMsCount]; entryFormCfg = cfg; currentOp = CurrentOp.None; @@ -85,8 +83,10 @@ namespace TBF.BenchControl.DataEntry.Standard /// Reference to the operation public IOperation ShowWMSNsAndStatesFormOp() { - return null; - } + if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); + currentOp = CurrentOp.EnterWMStates; + return this; + } /// Reference to the operation public IOperation ShowWMStatesFormOp() @@ -107,6 +107,12 @@ namespace TBF.BenchControl.DataEntry.Standard myRef.modelessDlg = new CycleEndForm(Program.WMsCount); modelessDlg.Show(); } + /// + void OpenWMStatesDlg(EntryForm myRef) + { + myRef.modelessDlg = new WMStatesForm(Program.WMsCount); + modelessDlg.Show(); + } /// Start this operation public void Start() @@ -120,7 +126,10 @@ namespace TBF.BenchControl.DataEntry.Standard case CurrentOp.ShowFormAtCycleEnd: Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this); break; - } + case CurrentOp.EnterWMStates: + Program.MainWnd.Invoke(new EntryFormDlgt(OpenWMStatesDlg), this); + break; + } } /// Run this operation @@ -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; modelessDlg = null; } diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.cs new file mode 100644 index 000000000..5730e0583 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.cs @@ -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)); + + /// Number of text boxes for serial numbers + 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; + + /// + /// Constructor + /// + /// Number of text boxes for serial numbers + public WMStatesForm(int waterMetersCount) + { + this.WaterMetersCount = waterMetersCount; + InitializeComponent(); + WMState = new float[WaterMetersCount]; + completed = false; + StartForceCloseHandler(); + } + + /// Parameterless constructor for all watermeters + 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(OnForceClose), sender, args); } + else OnForceClose(sender, args); + }; + } + + void OnForceClose(object sender, EventArgs args) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + #endregion + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.designer.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.designer.cs new file mode 100644 index 000000000..8db7e0aef --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.designer.cs @@ -0,0 +1,302 @@ +namespace TBF.BenchControl.DataEntry.Standard +{ + partial class WMStatesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + + } +} \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.resx b/TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/WMStatesForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs index 2b02bf837..0757f5888 100644 --- a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs @@ -95,13 +95,13 @@ namespace TBF.BenchControl.DataEntry.WMStates delegate void EntryFormDlgt(EntryForm myRef); /// - void OpenBeginningDlg(EntryForm myRef) + void OpenWMSNsAndStatesDlg(EntryForm myRef) { myRef.modelessDlg = new WMSNsAndStatesForm(Program.WMsCount); modelessDlg.Show(); } - /// - void OpenEndDlg(EntryForm myRef) + /// + void OpenWMStatesDlg(EntryForm myRef) { myRef.modelessDlg = new WMStatesForm(Program.WMsCount); modelessDlg.Show(); @@ -114,10 +114,10 @@ namespace TBF.BenchControl.DataEntry.WMStates switch (currentOp) { case CurrentOp.EnterWMSNsAndStates: - Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this); + Program.MainWnd.Invoke(new EntryFormDlgt(OpenWMSNsAndStatesDlg), this); break; case CurrentOp.EnterWMStates: - Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this); + Program.MainWnd.Invoke(new EntryFormDlgt(OpenWMStatesDlg), this); break; } } diff --git a/TestBenchFramework/BenchControl/GenericDevices/IDataEntry.cs b/TestBenchFramework/BenchControl/GenericDevices/IDataEntry.cs index 001e852d4..60cbfb2c3 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/IDataEntry.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/IDataEntry.cs @@ -5,46 +5,6 @@ namespace TBF.BenchControl.GenericDevices { public interface IDataEntry : IComponent { - /// - /// Water meter serial numbers set by forms - /// - string SerialNr(int wmNr); - - /// - /// Water meter states set by forms - /// - float WMState(int wmNr); - - - /// - /// Displays form at the beginning of the cycle (usually to enter S/N). - /// - /// Watermetes to be updated by the operation - /// Operation to be used in the sequence - IOperation ShowCycleBeginFormOp(IList waterMeters); - - /// - /// Displays form at the end of the cycle (usually to enter the end state). - /// - /// Watermetes to be updated by the operation - /// Operation to be used in the sequence - IOperation ShowCycleEndFormOp(IList waterMeters); - - /// - /// Displays form at the beginning of the cycle (usually to enter S/N). - /// - /// Watermetes to be updated by the operation - /// Operation to be used in the sequence - IOperation ShowWMSNsAndStatesFormOp(); - - /// - /// Displays form at the beginning of the cycle (usually to enter S/N). - /// - /// Watermetes to be updated by the operation - /// Operation to be used in the sequence - IOperation ShowWMStatesFormOp(); - - /// /// Updates test results with the information collected in watermeters. /// diff --git a/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs b/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs index 2185a3108..1bb96a832 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs @@ -3,7 +3,12 @@ namespace TBF.BenchControl.GenericDevices { public interface IHasWMStatesForm { - /// + /// + /// Water meter states set by forms + /// + float WMState(int wmNr); + + /// /// Displays form at the beginning of the cycle (usually to enter S/N). /// /// Watermetes to be updated by the operation diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index 98ad4b2ee..ae02b21a8 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -218,9 +218,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection /// /// Enter watermeter begin states here /// - GenericDevices.IDataEntry dataEntryCmpnt = - TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry; - if (dataEntryCmpnt is GenericDevices.IHasWMStatesForm) + GenericDevices.IHasWMStatesForm dataEntryCmpnt = + TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm; + if (dataEntryCmpnt != null) { Bridge.OnActivity(this, "Enter the water meter data"); State.Create("FixedStartMassCollection : Enter begin-state") @@ -244,6 +244,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection registerReader.EndWMState = dataEntryCmpnt.WMState(i); 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 /// - if (dataEntryCmpnt is GenericDevices.IHasWMStatesForm) + if (dataEntryCmpnt != null) { Bridge.OnActivity(this, "Enter the water meter data"); State.Create("FixedStartMassCollection : Enter end-state") - .AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowWMStatesFormOp()) + .AddOperation(dataEntryCmpnt.ShowWMStatesFormOp()) .AddOperation(checkUiOp) .EnterState(); do @@ -448,8 +452,16 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection { BenchControl.Elde.FixedStartRegisterReader.RegisterReader 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); + } } } diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 84c47b835..9b0549b47 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -132,6 +132,12 @@ + + Form + + + WMStatesForm.cs + Component @@ -1137,6 +1143,9 @@ EntryFormCfgCtrl.cs + + WMStatesForm.cs + WMSNsAndStatesForm.cs