From d1e9537610aaeb02585ae3217af45dbbe44a42dd Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Tue, 24 Mar 2015 10:09:12 +0100 Subject: [PATCH] DataEntry.Standard (with checkBoxes) and DataEntry.Combined entry forms added. IWaterMeter.Disabled supported. --- .../Combined/CycleBeginningForm.Designer.cs | 250 ++++ .../DataEntry/Combined/CycleBeginningForm.cs | 93 ++ .../Combined/CycleBeginningForm.resx | 168 +++ .../Combined/CycleEndForm.Designer.cs | 440 +++++++ .../DataEntry/Combined/CycleEndForm.cs | 154 +++ .../DataEntry/Combined/CycleEndForm.resx | 219 ++++ .../DataEntry/Combined/EntryForm.cs | 183 +++ .../DataEntry/Combined/EntryFormCfg.cs | 46 + .../DataEntry/Combined/EntryFormCfgCtrl.cs | 77 ++ .../Combined/EntryFormCfgCtrl.designer.cs | 152 +++ .../DataEntry/Combined/EntryFormCfgCtrl.resx | 120 ++ .../DataEntry/Combined/EntryFormFactory.cs | 18 + .../Standard/CycleBeginningForm.Designer.cs | 305 +++++ .../DataEntry/Standard/CycleBeginningForm.cs | 137 +++ .../Standard/CycleBeginningForm.resx | 1023 +++++++++++++++++ .../Standard/CycleEndForm.Designer.cs | 302 +++++ .../DataEntry/Standard/CycleEndForm.cs | 105 ++ .../DataEntry/Standard/CycleEndForm.resx | 120 ++ .../DataEntry/Standard/EntryForm.cs | 179 +++ .../DataEntry/Standard/EntryFormCfg.cs | 46 + .../DataEntry/Standard/EntryFormCfgCtrl.cs | 77 ++ .../Standard/EntryFormCfgCtrl.designer.cs | 152 +++ .../DataEntry/Standard/EntryFormCfgCtrl.resx | 120 ++ .../DataEntry/Standard/EntryFormFactory.cs | 18 + .../GenericDevices/IWaterMeter.cs | 1 + .../BenchControl/WaterMeter/WaterMeter.cs | 7 + TestBenchFramework/TBF.csproj | 60 + 27 files changed, 4572 insertions(+) create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.Designer.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.resx create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.Designer.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.resx create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/EntryForm.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfg.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.designer.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.resx create mode 100644 TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormFactory.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.Designer.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.resx create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.Designer.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.resx create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfg.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.designer.cs create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.resx create mode 100644 TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormFactory.cs diff --git a/TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.Designer.cs b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.Designer.cs new file mode 100644 index 000000000..0dc329ee5 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.Designer.cs @@ -0,0 +1,250 @@ +namespace TBF.BenchControl.DataEntry.Combined +{ + partial class CycleBeginningForm + { + /// + /// 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.okButton = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.auxSN1TextBox = new System.Windows.Forms.TextBox(); + this.auxSN1Label = new System.Windows.Forms.Label(); + this.mainSN1TextBox = new System.Windows.Forms.TextBox(); + this.mainSN1Label = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.auxSN2TextBox = new System.Windows.Forms.TextBox(); + this.auxSN2Label = new System.Windows.Forms.Label(); + this.mainSN2TextBox = new System.Windows.Forms.TextBox(); + this.mainSN2Label = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.auxSN3TextBox = new System.Windows.Forms.TextBox(); + this.auxSN3Label = new System.Windows.Forms.Label(); + this.mainSN3TextBox = new System.Windows.Forms.TextBox(); + this.mainSN3Label = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.SuspendLayout(); + // + // 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(527, 43); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(98, 63); + this.okButton.TabIndex = 0; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.auxSN1TextBox); + this.groupBox1.Controls.Add(this.auxSN1Label); + this.groupBox1.Controls.Add(this.mainSN1TextBox); + this.groupBox1.Controls.Add(this.mainSN1Label); + 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(28, 18); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(464, 137); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Water Meter 1"; + // + // auxSN1TextBox + // + this.auxSN1TextBox.Location = new System.Drawing.Point(262, 83); + this.auxSN1TextBox.Name = "auxSN1TextBox"; + this.auxSN1TextBox.Size = new System.Drawing.Size(163, 31); + this.auxSN1TextBox.TabIndex = 3; + // + // auxSN1Label + // + this.auxSN1Label.AutoSize = true; + this.auxSN1Label.Location = new System.Drawing.Point(21, 86); + this.auxSN1Label.Name = "auxSN1Label"; + this.auxSN1Label.Size = new System.Drawing.Size(193, 23); + this.auxSN1Label.TabIndex = 2; + this.auxSN1Label.Text = "Aux. WM Serial Nr."; + // + // mainSN1TextBox + // + this.mainSN1TextBox.Location = new System.Drawing.Point(262, 37); + this.mainSN1TextBox.Name = "mainSN1TextBox"; + this.mainSN1TextBox.Size = new System.Drawing.Size(163, 31); + this.mainSN1TextBox.TabIndex = 1; + // + // mainSN1Label + // + this.mainSN1Label.AutoSize = true; + this.mainSN1Label.Location = new System.Drawing.Point(21, 40); + this.mainSN1Label.Name = "mainSN1Label"; + this.mainSN1Label.Size = new System.Drawing.Size(195, 23); + this.mainSN1Label.TabIndex = 0; + this.mainSN1Label.Text = "Main WM Serial Nr."; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.auxSN2TextBox); + this.groupBox2.Controls.Add(this.auxSN2Label); + this.groupBox2.Controls.Add(this.mainSN2TextBox); + this.groupBox2.Controls.Add(this.mainSN2Label); + 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(28, 175); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(464, 137); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Water Meter 2"; + // + // auxSN2TextBox + // + this.auxSN2TextBox.Location = new System.Drawing.Point(262, 83); + this.auxSN2TextBox.Name = "auxSN2TextBox"; + this.auxSN2TextBox.Size = new System.Drawing.Size(163, 31); + this.auxSN2TextBox.TabIndex = 3; + // + // auxSN2Label + // + this.auxSN2Label.AutoSize = true; + this.auxSN2Label.Location = new System.Drawing.Point(21, 86); + this.auxSN2Label.Name = "auxSN2Label"; + this.auxSN2Label.Size = new System.Drawing.Size(193, 23); + this.auxSN2Label.TabIndex = 2; + this.auxSN2Label.Text = "Aux. WM Serial Nr."; + // + // mainSN2TextBox + // + this.mainSN2TextBox.Location = new System.Drawing.Point(262, 37); + this.mainSN2TextBox.Name = "mainSN2TextBox"; + this.mainSN2TextBox.Size = new System.Drawing.Size(163, 31); + this.mainSN2TextBox.TabIndex = 1; + // + // mainSN2Label + // + this.mainSN2Label.AutoSize = true; + this.mainSN2Label.Location = new System.Drawing.Point(21, 40); + this.mainSN2Label.Name = "mainSN2Label"; + this.mainSN2Label.Size = new System.Drawing.Size(195, 23); + this.mainSN2Label.TabIndex = 0; + this.mainSN2Label.Text = "Main WM Serial Nr."; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.auxSN3TextBox); + this.groupBox3.Controls.Add(this.auxSN3Label); + this.groupBox3.Controls.Add(this.mainSN3TextBox); + this.groupBox3.Controls.Add(this.mainSN3Label); + 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(28, 330); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(464, 137); + this.groupBox3.TabIndex = 3; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Water Meter 3"; + // + // auxSN3TextBox + // + this.auxSN3TextBox.Location = new System.Drawing.Point(262, 83); + this.auxSN3TextBox.Name = "auxSN3TextBox"; + this.auxSN3TextBox.Size = new System.Drawing.Size(163, 31); + this.auxSN3TextBox.TabIndex = 3; + // + // auxSN3Label + // + this.auxSN3Label.AutoSize = true; + this.auxSN3Label.Location = new System.Drawing.Point(21, 86); + this.auxSN3Label.Name = "auxSN3Label"; + this.auxSN3Label.Size = new System.Drawing.Size(193, 23); + this.auxSN3Label.TabIndex = 2; + this.auxSN3Label.Text = "Aux. WM Serial Nr."; + // + // mainSN3TextBox + // + this.mainSN3TextBox.Location = new System.Drawing.Point(262, 37); + this.mainSN3TextBox.Name = "mainSN3TextBox"; + this.mainSN3TextBox.Size = new System.Drawing.Size(163, 31); + this.mainSN3TextBox.TabIndex = 1; + // + // mainSN3Label + // + this.mainSN3Label.AutoSize = true; + this.mainSN3Label.Location = new System.Drawing.Point(21, 40); + this.mainSN3Label.Name = "mainSN3Label"; + this.mainSN3Label.Size = new System.Drawing.Size(195, 23); + this.mainSN3Label.TabIndex = 0; + this.mainSN3Label.Text = "Main WM Serial Nr."; + // + // CycleBeginningForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.BackColor = System.Drawing.Color.DarkGoldenrod; + this.ClientSize = new System.Drawing.Size(653, 492); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.okButton); + this.ForeColor = System.Drawing.Color.Black; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "CycleBeginningForm"; + this.Text = "Daten"; + this.TopMost = true; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label mainSN1Label; + private System.Windows.Forms.TextBox mainSN1TextBox; + private System.Windows.Forms.TextBox auxSN1TextBox; + private System.Windows.Forms.Label auxSN1Label; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox auxSN2TextBox; + private System.Windows.Forms.Label auxSN2Label; + private System.Windows.Forms.TextBox mainSN2TextBox; + private System.Windows.Forms.Label mainSN2Label; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox auxSN3TextBox; + private System.Windows.Forms.Label auxSN3Label; + private System.Windows.Forms.TextBox mainSN3TextBox; + private System.Windows.Forms.Label mainSN3Label; + } +} \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.cs b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.cs new file mode 100644 index 000000000..d078120bf --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.cs @@ -0,0 +1,93 @@ +using System; +using System.Windows.Forms; +using log4net; +using TBF.Resources; + +#pragma warning disable 162 /// Disables 'Unreachable code detected' warning + +namespace TBF.BenchControl.DataEntry.Combined +{ + public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted + { + private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm)); + + // To be retrieved after the form closes + public string[] MainSNText; + public string[] AuxSNText; + public bool[] WMExists; + + // Set to 'true' when the form closes + public bool Completed { get { return completed; } } + bool completed; + + public CycleBeginningForm() + { + InitializeComponent(); + + MainSNText = new string[Program.WMsCount / 2]; + AuxSNText = new string[Program.WMsCount / 2]; + completed = false; + StartForceCloseHandler(); + + if (Program.WMsCount / 2 < 2) Height = 200; + else if (Program.WMsCount / 2 < 3) Height = 355; + + Localize(); + } + + void Localize() + { + Text = Strings.Data; + groupBox1.Text = Strings.Water_Meter + " 1"; + mainSN1Label.Text = Strings.Main_WM_SerialNr; + auxSN1Label.Text = Strings.Aux_WM_SerialNr; + groupBox2.Text = Strings.Water_Meter + " 2"; + mainSN2Label.Text = Strings.Main_WM_SerialNr; + auxSN2Label.Text = Strings.Aux_WM_SerialNr; + groupBox3.Text = Strings.Water_Meter + " 3"; + mainSN3Label.Text = Strings.Main_WM_SerialNr; + auxSN3Label.Text = Strings.Aux_WM_SerialNr; + okButton.Text = Strings.OkBtnText; + } + + private void okButton_Click(object sender, EventArgs e) + { + MainSNText[0] = mainSN1TextBox.Text; + AuxSNText[0] = auxSN1TextBox.Text; + + if (Program.WMsCount / 2 >= 2) + { + MainSNText[1] = mainSN2TextBox.Text; + AuxSNText[1] = auxSN2TextBox.Text; + } + + if (Program.WMsCount / 2 >= 3) + { + MainSNText[2] = mainSN3TextBox.Text; + AuxSNText[2] = auxSN3TextBox.Text; + } + + completed = true; + Close(); + } + + #region Forced close handling + + public void StartForceCloseHandler() + { + UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args) + { + if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); } + else OnForceClose(sender, args); + }; + } + + void OnForceClose(object sender, EventArgs args) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + #endregion + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.resx b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.resx new file mode 100644 index 000000000..714731c15 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleBeginningForm.resx @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.Designer.cs b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.Designer.cs new file mode 100644 index 000000000..6b1f26bec --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.Designer.cs @@ -0,0 +1,440 @@ +namespace TBF.BenchControl.DataEntry.Combined +{ + partial class CycleEndForm + { + /// + /// 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.mainState1TextBox = new System.Windows.Forms.TextBox(); + this.mainState1Label = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.qFall1Label = new System.Windows.Forms.Label(); + this.qFall1TextBox = new System.Windows.Forms.TextBox(); + this.qRise1Label = new System.Windows.Forms.Label(); + this.qRise1TextBox = new System.Windows.Forms.TextBox(); + this.auxState1TextBox = new System.Windows.Forms.TextBox(); + this.auxState1Label = new System.Windows.Forms.Label(); + this.okButton = new System.Windows.Forms.Button(); + this.protocolGroupBox = new System.Windows.Forms.GroupBox(); + this.radioButton3 = new System.Windows.Forms.RadioButton(); + this.radioButton2 = new System.Windows.Forms.RadioButton(); + this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.qFall2Label = new System.Windows.Forms.Label(); + this.qFall2TextBox = new System.Windows.Forms.TextBox(); + this.qRise2Label = new System.Windows.Forms.Label(); + this.qRise2TextBox = new System.Windows.Forms.TextBox(); + this.mainState2TextBox = new System.Windows.Forms.TextBox(); + this.mainState2Label = new System.Windows.Forms.Label(); + this.auxState2TextBox = new System.Windows.Forms.TextBox(); + this.auxState2Label = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.qFall3Label = new System.Windows.Forms.Label(); + this.qFall3TextBox = new System.Windows.Forms.TextBox(); + this.qRise3Label = new System.Windows.Forms.Label(); + this.qRise3TextBox = new System.Windows.Forms.TextBox(); + this.mainState3TextBox = new System.Windows.Forms.TextBox(); + this.mainState3Label = new System.Windows.Forms.Label(); + this.auxState3TextBox = new System.Windows.Forms.TextBox(); + this.auxState3Label = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + this.protocolGroupBox.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.SuspendLayout(); + // + // mainState1TextBox + // + this.mainState1TextBox.Location = new System.Drawing.Point(211, 42); + this.mainState1TextBox.Name = "mainState1TextBox"; + this.mainState1TextBox.Size = new System.Drawing.Size(135, 31); + this.mainState1TextBox.TabIndex = 1; + // + // mainState1Label + // + this.mainState1Label.AutoSize = true; + this.mainState1Label.Location = new System.Drawing.Point(18, 45); + this.mainState1Label.Name = "mainState1Label"; + this.mainState1Label.Size = new System.Drawing.Size(153, 23); + this.mainState1Label.TabIndex = 0; + this.mainState1Label.Text = "Main WM State"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.qFall1Label); + this.groupBox1.Controls.Add(this.qFall1TextBox); + this.groupBox1.Controls.Add(this.qRise1Label); + this.groupBox1.Controls.Add(this.qRise1TextBox); + this.groupBox1.Controls.Add(this.mainState1TextBox); + this.groupBox1.Controls.Add(this.mainState1Label); + this.groupBox1.Controls.Add(this.auxState1TextBox); + this.groupBox1.Controls.Add(this.auxState1Label); + 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, 23); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(375, 237); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Water Meter 1"; + // + // qFall1Label + // + this.qFall1Label.AutoSize = true; + this.qFall1Label.Location = new System.Drawing.Point(18, 184); + this.qFall1Label.Name = "qFall1Label"; + this.qFall1Label.Size = new System.Drawing.Size(55, 23); + this.qFall1Label.TabIndex = 6; + this.qFall1Label.Text = "Qfall"; + // + // qFall1TextBox + // + this.qFall1TextBox.Location = new System.Drawing.Point(211, 177); + this.qFall1TextBox.Name = "qFall1TextBox"; + this.qFall1TextBox.Size = new System.Drawing.Size(135, 31); + this.qFall1TextBox.TabIndex = 7; + // + // qRise1Label + // + this.qRise1Label.AutoSize = true; + this.qRise1Label.Location = new System.Drawing.Point(18, 135); + this.qRise1Label.Name = "qRise1Label"; + this.qRise1Label.Size = new System.Drawing.Size(60, 23); + this.qRise1Label.TabIndex = 4; + this.qRise1Label.Text = "Qrise"; + // + // qRise1TextBox + // + this.qRise1TextBox.Location = new System.Drawing.Point(211, 132); + this.qRise1TextBox.Name = "qRise1TextBox"; + this.qRise1TextBox.Size = new System.Drawing.Size(135, 31); + this.qRise1TextBox.TabIndex = 5; + // + // auxState1TextBox + // + this.auxState1TextBox.Location = new System.Drawing.Point(211, 87); + this.auxState1TextBox.Name = "auxState1TextBox"; + this.auxState1TextBox.Size = new System.Drawing.Size(135, 31); + this.auxState1TextBox.TabIndex = 3; + // + // auxState1Label + // + this.auxState1Label.AutoSize = true; + this.auxState1Label.Location = new System.Drawing.Point(18, 90); + this.auxState1Label.Name = "auxState1Label"; + this.auxState1Label.Size = new System.Drawing.Size(151, 23); + this.auxState1Label.TabIndex = 2; + this.auxState1Label.Text = "Aux. WM 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(699, 33); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(98, 63); + this.okButton.TabIndex = 0; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // protocolGroupBox + // + this.protocolGroupBox.Controls.Add(this.radioButton3); + this.protocolGroupBox.Controls.Add(this.radioButton2); + this.protocolGroupBox.Controls.Add(this.radioButton1); + this.protocolGroupBox.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.protocolGroupBox.Location = new System.Drawing.Point(422, 118); + this.protocolGroupBox.Name = "protocolGroupBox"; + this.protocolGroupBox.Size = new System.Drawing.Size(375, 142); + this.protocolGroupBox.TabIndex = 4; + this.protocolGroupBox.TabStop = false; + this.protocolGroupBox.Text = "Protocol"; + // + // radioButton3 + // + this.radioButton3.AutoSize = true; + this.radioButton3.Location = new System.Drawing.Point(34, 100); + this.radioButton3.Name = "radioButton3"; + this.radioButton3.Size = new System.Drawing.Size(152, 27); + this.radioButton3.TabIndex = 2; + this.radioButton3.Text = "radioButton3"; + this.radioButton3.UseVisualStyleBackColor = true; + // + // radioButton2 + // + this.radioButton2.AutoSize = true; + this.radioButton2.Location = new System.Drawing.Point(34, 67); + this.radioButton2.Name = "radioButton2"; + this.radioButton2.Size = new System.Drawing.Size(152, 27); + this.radioButton2.TabIndex = 1; + this.radioButton2.Text = "radioButton2"; + this.radioButton2.UseVisualStyleBackColor = true; + // + // radioButton1 + // + this.radioButton1.AutoSize = true; + this.radioButton1.Checked = true; + this.radioButton1.Location = new System.Drawing.Point(34, 34); + this.radioButton1.Name = "radioButton1"; + this.radioButton1.Size = new System.Drawing.Size(152, 27); + this.radioButton1.TabIndex = 0; + this.radioButton1.TabStop = true; + this.radioButton1.Text = "radioButton1"; + this.radioButton1.UseVisualStyleBackColor = true; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.qFall2Label); + this.groupBox2.Controls.Add(this.qFall2TextBox); + this.groupBox2.Controls.Add(this.qRise2Label); + this.groupBox2.Controls.Add(this.qRise2TextBox); + this.groupBox2.Controls.Add(this.mainState2TextBox); + this.groupBox2.Controls.Add(this.mainState2Label); + this.groupBox2.Controls.Add(this.auxState2TextBox); + this.groupBox2.Controls.Add(this.auxState2Label); + 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, 282); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(375, 237); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Water Meter 2"; + // + // qFall2Label + // + this.qFall2Label.AutoSize = true; + this.qFall2Label.Location = new System.Drawing.Point(18, 184); + this.qFall2Label.Name = "qFall2Label"; + this.qFall2Label.Size = new System.Drawing.Size(55, 23); + this.qFall2Label.TabIndex = 6; + this.qFall2Label.Text = "Qfall"; + // + // qFall2TextBox + // + this.qFall2TextBox.Location = new System.Drawing.Point(211, 177); + this.qFall2TextBox.Name = "qFall2TextBox"; + this.qFall2TextBox.Size = new System.Drawing.Size(135, 31); + this.qFall2TextBox.TabIndex = 7; + // + // qRise2Label + // + this.qRise2Label.AutoSize = true; + this.qRise2Label.Location = new System.Drawing.Point(18, 135); + this.qRise2Label.Name = "qRise2Label"; + this.qRise2Label.Size = new System.Drawing.Size(60, 23); + this.qRise2Label.TabIndex = 4; + this.qRise2Label.Text = "Qrise"; + // + // qRise2TextBox + // + this.qRise2TextBox.Location = new System.Drawing.Point(211, 132); + this.qRise2TextBox.Name = "qRise2TextBox"; + this.qRise2TextBox.Size = new System.Drawing.Size(135, 31); + this.qRise2TextBox.TabIndex = 5; + // + // mainState2TextBox + // + this.mainState2TextBox.Location = new System.Drawing.Point(211, 42); + this.mainState2TextBox.Name = "mainState2TextBox"; + this.mainState2TextBox.Size = new System.Drawing.Size(135, 31); + this.mainState2TextBox.TabIndex = 1; + // + // mainState2Label + // + this.mainState2Label.AutoSize = true; + this.mainState2Label.Location = new System.Drawing.Point(17, 45); + this.mainState2Label.Name = "mainState2Label"; + this.mainState2Label.Size = new System.Drawing.Size(153, 23); + this.mainState2Label.TabIndex = 0; + this.mainState2Label.Text = "Main WM State"; + // + // auxState2TextBox + // + this.auxState2TextBox.Location = new System.Drawing.Point(211, 87); + this.auxState2TextBox.Name = "auxState2TextBox"; + this.auxState2TextBox.Size = new System.Drawing.Size(135, 31); + this.auxState2TextBox.TabIndex = 3; + // + // auxState2Label + // + this.auxState2Label.AutoSize = true; + this.auxState2Label.Location = new System.Drawing.Point(18, 90); + this.auxState2Label.Name = "auxState2Label"; + this.auxState2Label.Size = new System.Drawing.Size(151, 23); + this.auxState2Label.TabIndex = 2; + this.auxState2Label.Text = "Aux. WM State"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.qFall3Label); + this.groupBox3.Controls.Add(this.qFall3TextBox); + this.groupBox3.Controls.Add(this.qRise3Label); + this.groupBox3.Controls.Add(this.qRise3TextBox); + this.groupBox3.Controls.Add(this.mainState3TextBox); + this.groupBox3.Controls.Add(this.mainState3Label); + this.groupBox3.Controls.Add(this.auxState3TextBox); + this.groupBox3.Controls.Add(this.auxState3Label); + 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(422, 282); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(375, 237); + this.groupBox3.TabIndex = 3; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Water Meter 3"; + // + // qFall3Label + // + this.qFall3Label.AutoSize = true; + this.qFall3Label.Location = new System.Drawing.Point(18, 184); + this.qFall3Label.Name = "qFall3Label"; + this.qFall3Label.Size = new System.Drawing.Size(55, 23); + this.qFall3Label.TabIndex = 6; + this.qFall3Label.Text = "Qfall"; + // + // qFall3TextBox + // + this.qFall3TextBox.Location = new System.Drawing.Point(211, 177); + this.qFall3TextBox.Name = "qFall3TextBox"; + this.qFall3TextBox.Size = new System.Drawing.Size(135, 31); + this.qFall3TextBox.TabIndex = 7; + // + // qRise3Label + // + this.qRise3Label.AutoSize = true; + this.qRise3Label.Location = new System.Drawing.Point(18, 135); + this.qRise3Label.Name = "qRise3Label"; + this.qRise3Label.Size = new System.Drawing.Size(60, 23); + this.qRise3Label.TabIndex = 4; + this.qRise3Label.Text = "Qrise"; + // + // qRise3TextBox + // + this.qRise3TextBox.Location = new System.Drawing.Point(211, 132); + this.qRise3TextBox.Name = "qRise3TextBox"; + this.qRise3TextBox.Size = new System.Drawing.Size(135, 31); + this.qRise3TextBox.TabIndex = 5; + // + // mainState3TextBox + // + this.mainState3TextBox.Location = new System.Drawing.Point(211, 42); + this.mainState3TextBox.Name = "mainState3TextBox"; + this.mainState3TextBox.Size = new System.Drawing.Size(135, 31); + this.mainState3TextBox.TabIndex = 1; + // + // mainState3Label + // + this.mainState3Label.AutoSize = true; + this.mainState3Label.Location = new System.Drawing.Point(18, 45); + this.mainState3Label.Name = "mainState3Label"; + this.mainState3Label.Size = new System.Drawing.Size(153, 23); + this.mainState3Label.TabIndex = 0; + this.mainState3Label.Text = "Main WM State"; + // + // auxState3TextBox + // + this.auxState3TextBox.Location = new System.Drawing.Point(211, 87); + this.auxState3TextBox.Name = "auxState3TextBox"; + this.auxState3TextBox.Size = new System.Drawing.Size(135, 31); + this.auxState3TextBox.TabIndex = 3; + // + // auxState3Label + // + this.auxState3Label.AutoSize = true; + this.auxState3Label.Location = new System.Drawing.Point(18, 90); + this.auxState3Label.Name = "auxState3Label"; + this.auxState3Label.Size = new System.Drawing.Size(151, 23); + this.auxState3Label.TabIndex = 2; + this.auxState3Label.Text = "Aux. WM 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(822, 542); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.protocolGroupBox); + this.Controls.Add(this.okButton); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "CycleEndForm"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Daten"; + this.TopMost = true; + this.Load += new System.EventHandler(this.CycleEndForm_Load); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.protocolGroupBox.ResumeLayout(false); + this.protocolGroupBox.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TextBox mainState1TextBox; + private System.Windows.Forms.Label mainState1Label; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox auxState1TextBox; + private System.Windows.Forms.Label auxState1Label; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.GroupBox protocolGroupBox; + private System.Windows.Forms.RadioButton radioButton3; + private System.Windows.Forms.RadioButton radioButton2; + private System.Windows.Forms.RadioButton radioButton1; + private System.Windows.Forms.Label qFall1Label; + private System.Windows.Forms.TextBox qFall1TextBox; + private System.Windows.Forms.Label qRise1Label; + private System.Windows.Forms.TextBox qRise1TextBox; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Label qFall2Label; + private System.Windows.Forms.TextBox qFall2TextBox; + private System.Windows.Forms.Label qRise2Label; + private System.Windows.Forms.TextBox qRise2TextBox; + private System.Windows.Forms.TextBox mainState2TextBox; + private System.Windows.Forms.Label mainState2Label; + private System.Windows.Forms.TextBox auxState2TextBox; + private System.Windows.Forms.Label auxState2Label; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Label qFall3Label; + private System.Windows.Forms.TextBox qFall3TextBox; + private System.Windows.Forms.Label qRise3Label; + private System.Windows.Forms.TextBox qRise3TextBox; + private System.Windows.Forms.TextBox mainState3TextBox; + private System.Windows.Forms.Label mainState3Label; + private System.Windows.Forms.TextBox auxState3TextBox; + private System.Windows.Forms.Label auxState3Label; + + } +} \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.cs b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.cs new file mode 100644 index 000000000..51fe80376 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.cs @@ -0,0 +1,154 @@ +using System; +using System.Windows.Forms; +using log4net; +using TBF.Resources; + +#pragma warning disable 162 /// Disables 'Unreachable code detected' warning + +namespace TBF.BenchControl.DataEntry.Combined +{ + public partial class CycleEndForm : Form, GenericDevices.IHasCompleted + { + private static readonly ILog log = LogManager.GetLogger(typeof(CycleEndForm)); + + // To be set before the form opens + public string ProtocolName1; + public string ProtocolName2; + public string ProtocolName3; + + // To be retrieved after the form closes + public string[] MainStateText; + public string[] AuxStateText; + public float[] QRise; + public float[] QFall; + public string ProtocolTitle; + + // Set to 'true' when the form closes + public bool Completed { get { return completed; } } + bool completed; + + public CycleEndForm() + { + InitializeComponent(); + + MainStateText = new string[Program.WMsCount / 2]; + AuxStateText = new string[Program.WMsCount / 2]; + QRise = new float[Program.WMsCount / 2]; + QFall = new float[Program.WMsCount / 2]; + completed = false; + StartForceCloseHandler(); + + Localize(); + } + + void Localize() + { + Text = Strings.Data; + protocolGroupBox.Text = Strings.Protocol; + groupBox1.Text = Strings.Water_Meter + " 1"; + mainState1Label.Text = Strings.Main_Water_Meter_State; + auxState1Label.Text = Strings.Aux_Water_Meter_State; + qRise1Label.Text = Strings.Qrise; + qFall1Label.Text = Strings.Qfall; + + groupBox2.Text = Strings.Water_Meter + " 2"; + mainState2Label.Text = Strings.Main_Water_Meter_State; + auxState2Label.Text = Strings.Aux_Water_Meter_State; + qRise2Label.Text = Strings.Qrise; + qFall2Label.Text = Strings.Qfall; + + groupBox3.Text = Strings.Water_Meter + " 3"; + mainState3Label.Text = Strings.Main_Water_Meter_State; + auxState3Label.Text = Strings.Aux_Water_Meter_State; + qRise3Label.Text = Strings.Qrise; + qFall3Label.Text = Strings.Qfall; + } + + private void CycleEndForm_Load(object sender, EventArgs e) + { + radioButton1.Text = ProtocolName1; + radioButton2.Text = ProtocolName2; + radioButton3.Text = ProtocolName3; + + qRise1TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qrise, 3); + qFall1TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qfall, 3); + + if (Program.WMsCount / 2 >= 2) + { + qRise2TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qrise, 3); + qFall2TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qfall, 3); + } + else + { + groupBox2.Visible = false; + Height = 305; + } + + if (Program.WMsCount / 2 >= 3) + { + qRise3TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qrise, 3); + qFall3TextBox.Text = Utils.FloatToStr(Sequences.SequenceBase.Qfall, 3); + } + else + { + groupBox3.Visible = false; + } + } + + private void okButton_Click(object sender, EventArgs e) + { + float ftmp; + bool allOK = true; + + MainStateText[0] = mainState1TextBox.Text; + AuxStateText[0] = auxState1TextBox.Text; + if (Utils.TryParseUFloat(qRise1TextBox.Text, out ftmp)) { QRise[0] = ftmp; } else { allOK = false; } + if (Utils.TryParseUFloat(qFall1TextBox.Text, out ftmp)) { QFall[0] = ftmp; } else { allOK = false; } + + if (Program.WMsCount / 2 >= 2) + { + MainStateText[1] = mainState2TextBox.Text; + AuxStateText[1] = auxState2TextBox.Text; + if (Utils.TryParseUFloat(qRise2TextBox.Text, out ftmp)) { QRise[1] = ftmp; } else { allOK = false; } + if (Utils.TryParseUFloat(qFall2TextBox.Text, out ftmp)) { QFall[1] = ftmp; } else { allOK = false; } + } + + if (Program.WMsCount / 2 >= 3) + { + MainStateText[2] = mainState3TextBox.Text; + AuxStateText[2] = auxState3TextBox.Text; + if (Utils.TryParseUFloat(qRise3TextBox.Text, out ftmp)) { QRise[2] = ftmp; } else { allOK = false; } + if (Utils.TryParseUFloat(qFall3TextBox.Text, out ftmp)) { QFall[2] = ftmp; } else { allOK = false; } + } + + if (radioButton1.Checked) ProtocolTitle = ProtocolName1; + else if (radioButton2.Checked) ProtocolTitle = ProtocolName2; + else if (radioButton3.Checked) ProtocolTitle = ProtocolName3; + + if (allOK) + { + 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/Combined/CycleEndForm.resx b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.resx new file mode 100644 index 000000000..e2e65bced --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/CycleEndForm.resx @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/DataEntry/Combined/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryForm.cs new file mode 100644 index 000000000..2a9b31bf6 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryForm.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using log4net; +using TBF.BenchControl; +using TBF.BenchControl.GenericDevices; + +namespace TBF.BenchControl.DataEntry.Combined +{ + public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasProtocolTitle + { + private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm)); + public override string ToString() { return string.Format("DataEntry.Combined({0})", Cfg.ToString(1)); } + + readonly EntryFormCfg entryFormCfg; + + /// + /// Properties set by the Begin and the End form + /// + public string ProtocolTitle { get { return protocolTitle; } } + string protocolTitle; + + /// Not supported in Munich + public string SerialNr(int wmNr) { return string.Empty; } + + /// Not supported in Munich + public float WMState(int wmNr) { return 0; } + + + System.Windows.Forms.Form modelessDlg; + + bool resultSaved; + + IList wMeters; + + public enum CurrentOp + { + None, + ShowFormAtCycleBeginning, + ShowFormAtCycleEnd, + } + + CurrentOp currentOp; + + + public EntryForm(EntryFormCfg cfg) + : base(cfg) + { + entryFormCfg = cfg; + currentOp = CurrentOp.None; + log.Debug(this.ToString()); + } + + /// Reference to the operation + public IOperation ShowCycleBeginFormOp(IList waterMeters) + { + if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); + currentOp = CurrentOp.ShowFormAtCycleBeginning; + this.wMeters = waterMeters; + return this; + } + + /// Reference to the operation + public IOperation ShowCycleEndFormOp(IList waterMeters) + { + if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); + currentOp = CurrentOp.ShowFormAtCycleEnd; + this.wMeters = waterMeters; + return this; + } + + /// Reference to the operation + public IOperation ShowWMSNsAndStatesFormOp() + { + return null; + } + + /// Reference to the operation + public IOperation ShowWMStatesFormOp() + { + return null; + } + + delegate void EntryFormDlgt(EntryForm myRef); + /// + void OpenBeginningDlg(EntryForm myRef) + { + myRef.modelessDlg = new CycleBeginningForm(); + modelessDlg.Show(); + } + /// + void OpenEndDlg(EntryForm myRef) + { + CycleEndForm endForm = new CycleEndForm(); + endForm.ProtocolName1 = entryFormCfg.ProtocolTitle1; + endForm.ProtocolName2 = entryFormCfg.ProtocolTitle2; + endForm.ProtocolName3 = entryFormCfg.ProtocolTitle3; + myRef.modelessDlg = endForm; + modelessDlg.Show(); + } + + /// Start this operation + public void Start() + { + resultSaved = false; + switch (currentOp) + { + case CurrentOp.ShowFormAtCycleBeginning: + Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this); + break; + case CurrentOp.ShowFormAtCycleEnd: + Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this); + break; + } + } + + /// Run this operation + /// Event.ResultsPrinted + public Event Run() + { + if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed) + { + return Event.ModelessFormIsOpen; + } + + if (!resultSaved) /// This is to save the result only once + { + if (modelessDlg is CycleBeginningForm) + { + if (wMeters.Count >= 2 && wMeters[0] != null) wMeters[0].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[0]; + if (wMeters.Count >= 2 && wMeters[1] != null) wMeters[1].SerialNr = (modelessDlg as CycleBeginningForm).AuxSNText[0]; + if (wMeters.Count >= 4 && wMeters[2] != null) wMeters[2].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[1]; + if (wMeters.Count >= 4 && wMeters[3] != null) wMeters[3].SerialNr = (modelessDlg as CycleBeginningForm).AuxSNText[1]; + if (wMeters.Count >= 6 && wMeters[4] != null) wMeters[4].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[2]; + if (wMeters.Count >= 6 && wMeters[5] != null) wMeters[5].SerialNr = (modelessDlg as CycleBeginningForm).AuxSNText[2]; + } + else if (modelessDlg is CycleEndForm) + { + if (wMeters.Count >= 2 && wMeters[0] != null) wMeters[0].EndState = (modelessDlg as CycleEndForm).MainStateText[0]; + if (wMeters.Count >= 2 && wMeters[1] != null) wMeters[1].EndState = (modelessDlg as CycleEndForm).AuxStateText[0]; + if (wMeters.Count >= 4 && wMeters[2] != null) wMeters[2].EndState = (modelessDlg as CycleEndForm).MainStateText[1]; + if (wMeters.Count >= 4 && wMeters[3] != null) wMeters[3].EndState = (modelessDlg as CycleEndForm).AuxStateText[1]; + if (wMeters.Count >= 6 && wMeters[4] != null) wMeters[4].EndState = (modelessDlg as CycleEndForm).MainStateText[2]; + if (wMeters.Count >= 6 && wMeters[5] != null) wMeters[5].EndState = (modelessDlg as CycleEndForm).AuxStateText[2]; + protocolTitle = (modelessDlg as CycleEndForm).ProtocolTitle; + } + resultSaved = true; + modelessDlg = null; + } + + return Event.ModelessFormClosed; /// Form closed + } + + /// Stop this operation + public void Stop() + { + if (modelessDlg is IHasCompleted) + { + UiBridge.Bridge.OnCloseModelessForm(this, null); + modelessDlg = null; + } + currentOp = CurrentOp.None; + } + + /// + /// Updates test results with the information collected in watermeters. + /// + /// Watermetes with information entered in the forms + /// Test results to be updated with the information + public void UpdateTestResults(IList waterMeters, IList results) + { + foreach (var test in results) + { + if (test.MetersKind != Entities.MetersKind.Combined) continue; + + /// Todo: Generalize !!! Now implemented for Munich = one combined meter. + test.Meters[0].SerialNr = waterMeters[0].SerialNr; + test.Meters[0].EndState = waterMeters[0].EndState; + test.Meters[1].SerialNr = waterMeters[1].SerialNr; + test.Meters[1].EndState = waterMeters[1].EndState; + } + } + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfg.cs b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfg.cs new file mode 100644 index 000000000..3df5888e7 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfg.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.Serialization; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataEntry.Combined +{ + public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg + { + public IComponent GetComponent(IList components) { return new EntryForm(this); } + public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); } + + /// + /// Serialized parameters + /// + public string ProtocolTitle1; + public string ProtocolTitle2; + public string ProtocolTitle3; + + /// Private parameterless constructor invoked by all other (public) constructors + EntryFormCfg() + { + Name = "DataEntryForm-Munich"; + ParentName = string.Empty; + ProtocolTitle1 = "Protokoll Werkprüfung"; + ProtocolTitle2 = "Protokoll 2"; + ProtocolTitle3 = "Protokoll 3"; + } + + public EntryFormCfg(IComponentFactory factory) + : this() + { + this.Factory = factory; + } + + public string ToString(int i) + { + return string.Format("Name={0}, Protocol1={1}, Protocol2={2}, Protocol3={3}", + Name, + (string.IsNullOrEmpty(ProtocolTitle1) ? "-" : ProtocolTitle1), + (string.IsNullOrEmpty(ProtocolTitle2) ? "-" : ProtocolTitle2), + (string.IsNullOrEmpty(ProtocolTitle3) ? "-" : ProtocolTitle3)); + } + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.cs b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.cs new file mode 100644 index 000000000..8702d1858 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.cs @@ -0,0 +1,77 @@ +using System; +using System.Windows.Forms; +using log4net; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataEntry.Combined +{ + public partial class EntryFormCfgCtrl : UserControl, IComponentCfgCtrl + { + static readonly ILog log = LogManager.GetLogger(typeof(EntryFormCfgCtrl)); + + public bool ShowMore { get { return false; } } + + EntryFormCfg config; + public IComponentCfg Config + { + get { return config as IComponentCfg; } + set + { + config = value as EntryFormCfg; + Redraw(); + } + } + + public EntryFormCfgCtrl() + { + InitializeComponent(); + } + + private void EntryFormCfgCtrl_Load(object sender, EventArgs e) + { + Redraw(); + } + + public void Closing() + { + } + + void Redraw() + { + if (config == null) return; /// Control was not loaded, settings were not changed + classNameLabel.Text = config.Factory.ClassName; + nameTextBox.Text = config.Name; + protocolTitle1TextBox.Text = config.ProtocolTitle1; + protocolTitle2TextBox.Text = config.ProtocolTitle2; + protocolTitle3TextBox.Text = config.ProtocolTitle3; + } + + public void Unlock() + { + nameTextBox.Enabled = true; + protocolTitle1TextBox.Enabled = true; + protocolTitle2TextBox.Enabled = true; + protocolTitle3TextBox.Enabled = true; + } + + public CfgUpdateFlags VerifyCfg(ref string message) + { + CfgUpdateFlags flags = CfgUpdateFlags.None; + return flags; + } + + public CfgUpdateFlags UpdateCfg() + { + CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; + + if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed + + config.Name = nameTextBox.Text; + config.ProtocolTitle1 = protocolTitle1TextBox.Text; + config.ProtocolTitle2 = protocolTitle2TextBox.Text; + config.ProtocolTitle3 = protocolTitle3TextBox.Text; + + return flags; + } + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.designer.cs b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.designer.cs new file mode 100644 index 000000000..c3aa914a4 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.designer.cs @@ -0,0 +1,152 @@ +namespace TBF.BenchControl.DataEntry.Combined +{ + partial class EntryFormCfgCtrl + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.protocolTitle1TextBox = new System.Windows.Forms.TextBox(); + this.protocolTitle2TextBox = new System.Windows.Forms.TextBox(); + this.protocolTitle3TextBox = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // nameTextBox + // + this.nameTextBox.Enabled = false; + this.nameTextBox.Location = new System.Drawing.Point(137, 57); + this.nameTextBox.Name = "nameTextBox"; + this.nameTextBox.Size = new System.Drawing.Size(130, 20); + this.nameTextBox.TabIndex = 5; + // + // nameLabel + // + this.nameLabel.AutoSize = true; + this.nameLabel.Location = new System.Drawing.Point(27, 60); + this.nameLabel.Name = "nameLabel"; + this.nameLabel.Size = new System.Drawing.Size(35, 13); + this.nameLabel.TabIndex = 4; + this.nameLabel.Text = "Name"; + // + // classNameLabel + // + this.classNameLabel.AutoSize = true; + this.classNameLabel.Location = new System.Drawing.Point(134, 33); + this.classNameLabel.Name = "classNameLabel"; + this.classNameLabel.Size = new System.Drawing.Size(83, 13); + this.classNameLabel.TabIndex = 3; + this.classNameLabel.Text = "ComonentName"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(27, 86); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(74, 13); + this.label1.TabIndex = 6; + this.label1.Text = "Protocol title 1"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(27, 112); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(74, 13); + this.label2.TabIndex = 7; + this.label2.Text = "Protocol title 2"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(27, 138); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(74, 13); + this.label3.TabIndex = 8; + this.label3.Text = "Protocol title 3"; + // + // protocolTitle1TextBox + // + this.protocolTitle1TextBox.Enabled = false; + this.protocolTitle1TextBox.Location = new System.Drawing.Point(137, 83); + this.protocolTitle1TextBox.Name = "protocolTitle1TextBox"; + this.protocolTitle1TextBox.Size = new System.Drawing.Size(130, 20); + this.protocolTitle1TextBox.TabIndex = 9; + // + // protocolTitle2TextBox + // + this.protocolTitle2TextBox.Enabled = false; + this.protocolTitle2TextBox.Location = new System.Drawing.Point(137, 109); + this.protocolTitle2TextBox.Name = "protocolTitle2TextBox"; + this.protocolTitle2TextBox.Size = new System.Drawing.Size(130, 20); + this.protocolTitle2TextBox.TabIndex = 10; + // + // protocolTitle3TextBox + // + this.protocolTitle3TextBox.Enabled = false; + this.protocolTitle3TextBox.Location = new System.Drawing.Point(137, 135); + this.protocolTitle3TextBox.Name = "protocolTitle3TextBox"; + this.protocolTitle3TextBox.Size = new System.Drawing.Size(130, 20); + this.protocolTitle3TextBox.TabIndex = 11; + // + // EntryFormCfgCtrl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.protocolTitle3TextBox); + this.Controls.Add(this.protocolTitle2TextBox); + this.Controls.Add(this.protocolTitle1TextBox); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + 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(); + + } + + #endregion + + private System.Windows.Forms.TextBox nameTextBox; + private System.Windows.Forms.Label nameLabel; + private System.Windows.Forms.Label classNameLabel; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox protocolTitle1TextBox; + private System.Windows.Forms.TextBox protocolTitle2TextBox; + private System.Windows.Forms.TextBox protocolTitle3TextBox; + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.resx b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormCfgCtrl.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/Combined/EntryFormFactory.cs b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormFactory.cs new file mode 100644 index 000000000..b417c2964 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Combined/EntryFormFactory.cs @@ -0,0 +1,18 @@ +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataEntry.Combined +{ + public class EntryFormFactory : IComponentFactory + { + public string ClassName { get { return "DataEntryForm-Munich"; } } + + public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this); + } + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.Designer.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.Designer.cs new file mode 100644 index 000000000..0f1f95394 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.Designer.cs @@ -0,0 +1,305 @@ +namespace TBF.BenchControl.DataEntry.Standard +{ + partial class CycleBeginningForm + { + /// + /// 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() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm)); + this.okButton = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.checkBox7 = new System.Windows.Forms.CheckBox(); + this.checkBox3 = new System.Windows.Forms.CheckBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.checkBox4 = new System.Windows.Forms.CheckBox(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.checkBox5 = new System.Windows.Forms.CheckBox(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.checkBox6 = new System.Windows.Forms.CheckBox(); + this.textBox6 = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.SuspendLayout(); + // + // okButton + // + resources.ApplyResources(this.okButton, "okButton"); + this.okButton.ForeColor = System.Drawing.Color.Black; + this.okButton.Name = "okButton"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.checkBox1); + this.groupBox1.Controls.Add(this.textBox1); + this.groupBox1.Controls.Add(this.label1); + resources.ApplyResources(this.groupBox1, "groupBox1"); + this.groupBox1.ForeColor = System.Drawing.Color.Black; + this.groupBox1.Name = "groupBox1"; + this.groupBox1.TabStop = false; + // + // checkBox1 + // + resources.ApplyResources(this.checkBox1, "checkBox1"); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // textBox1 + // + resources.ApplyResources(this.textBox1, "textBox1"); + this.textBox1.Name = "textBox1"; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // label1 + // + resources.ApplyResources(this.label1, "label1"); + this.label1.Name = "label1"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.checkBox2); + this.groupBox2.Controls.Add(this.textBox2); + this.groupBox2.Controls.Add(this.label2); + resources.ApplyResources(this.groupBox2, "groupBox2"); + this.groupBox2.ForeColor = System.Drawing.Color.Black; + this.groupBox2.Name = "groupBox2"; + this.groupBox2.TabStop = false; + // + // checkBox2 + // + resources.ApplyResources(this.checkBox2, "checkBox2"); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.UseVisualStyleBackColor = true; + // + // textBox2 + // + resources.ApplyResources(this.textBox2, "textBox2"); + this.textBox2.Name = "textBox2"; + this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); + // + // label2 + // + resources.ApplyResources(this.label2, "label2"); + this.label2.Name = "label2"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.checkBox7); + this.groupBox3.Controls.Add(this.checkBox3); + this.groupBox3.Controls.Add(this.textBox3); + this.groupBox3.Controls.Add(this.label3); + resources.ApplyResources(this.groupBox3, "groupBox3"); + this.groupBox3.ForeColor = System.Drawing.Color.Black; + this.groupBox3.Name = "groupBox3"; + this.groupBox3.TabStop = false; + // + // checkBox7 + // + resources.ApplyResources(this.checkBox7, "checkBox7"); + this.checkBox7.Name = "checkBox7"; + this.checkBox7.UseVisualStyleBackColor = true; + // + // checkBox3 + // + resources.ApplyResources(this.checkBox3, "checkBox3"); + this.checkBox3.Name = "checkBox3"; + this.checkBox3.UseVisualStyleBackColor = true; + // + // textBox3 + // + resources.ApplyResources(this.textBox3, "textBox3"); + this.textBox3.Name = "textBox3"; + this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged); + // + // label3 + // + resources.ApplyResources(this.label3, "label3"); + this.label3.Name = "label3"; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.checkBox4); + this.groupBox4.Controls.Add(this.textBox4); + this.groupBox4.Controls.Add(this.label4); + resources.ApplyResources(this.groupBox4, "groupBox4"); + this.groupBox4.ForeColor = System.Drawing.Color.Black; + this.groupBox4.Name = "groupBox4"; + this.groupBox4.TabStop = false; + // + // checkBox4 + // + resources.ApplyResources(this.checkBox4, "checkBox4"); + this.checkBox4.Name = "checkBox4"; + this.checkBox4.UseVisualStyleBackColor = true; + // + // textBox4 + // + resources.ApplyResources(this.textBox4, "textBox4"); + this.textBox4.Name = "textBox4"; + this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged); + // + // label4 + // + resources.ApplyResources(this.label4, "label4"); + this.label4.Name = "label4"; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.checkBox5); + this.groupBox5.Controls.Add(this.textBox5); + this.groupBox5.Controls.Add(this.label5); + resources.ApplyResources(this.groupBox5, "groupBox5"); + this.groupBox5.ForeColor = System.Drawing.Color.Black; + this.groupBox5.Name = "groupBox5"; + this.groupBox5.TabStop = false; + // + // checkBox5 + // + resources.ApplyResources(this.checkBox5, "checkBox5"); + this.checkBox5.Name = "checkBox5"; + this.checkBox5.UseVisualStyleBackColor = true; + // + // textBox5 + // + resources.ApplyResources(this.textBox5, "textBox5"); + this.textBox5.Name = "textBox5"; + this.textBox5.TextChanged += new System.EventHandler(this.textBox5_TextChanged); + // + // label5 + // + resources.ApplyResources(this.label5, "label5"); + this.label5.Name = "label5"; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.checkBox6); + this.groupBox6.Controls.Add(this.textBox6); + this.groupBox6.Controls.Add(this.label6); + resources.ApplyResources(this.groupBox6, "groupBox6"); + this.groupBox6.ForeColor = System.Drawing.Color.Black; + this.groupBox6.Name = "groupBox6"; + this.groupBox6.TabStop = false; + // + // checkBox6 + // + resources.ApplyResources(this.checkBox6, "checkBox6"); + this.checkBox6.Name = "checkBox6"; + this.checkBox6.UseVisualStyleBackColor = true; + // + // textBox6 + // + resources.ApplyResources(this.textBox6, "textBox6"); + this.textBox6.Name = "textBox6"; + this.textBox6.TextChanged += new System.EventHandler(this.textBox6_TextChanged); + // + // label6 + // + resources.ApplyResources(this.label6, "label6"); + this.label6.Name = "label6"; + // + // CycleBeginningForm + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.DarkGoldenrod; + this.Controls.Add(this.groupBox6); + this.Controls.Add(this.groupBox5); + this.Controls.Add(this.groupBox4); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.okButton); + this.ForeColor = System.Drawing.Color.Black; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "CycleBeginningForm"; + this.TopMost = true; + this.Load += new System.EventHandler(this.CycleBeginningForm_Load); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.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.Button okButton; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.TextBox textBox5; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.TextBox textBox6; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.CheckBox checkBox2; + private System.Windows.Forms.CheckBox checkBox7; + private System.Windows.Forms.CheckBox checkBox3; + private System.Windows.Forms.CheckBox checkBox4; + private System.Windows.Forms.CheckBox checkBox5; + private System.Windows.Forms.CheckBox checkBox6; + } +} \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.cs new file mode 100644 index 000000000..8fc5581ce --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.cs @@ -0,0 +1,137 @@ +using System; +using System.Windows.Forms; +using log4net; +using TBF.Resources; + +namespace TBF.BenchControl.DataEntry.Standard +{ + public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted + { + private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm)); + + /// Number of text boxes for serial numbers + public readonly int WaterMetersCount; + + /// To be retrieved after the form is closed + public string[] SNText; + public bool[] Disabled; + + /// Set to 'true' when the form closes + public bool Completed { get { return completed; } } + bool completed; + + /// + /// Constructor + /// + /// Number of text boxes for serial numbers + public CycleBeginningForm(int waterMetersCount) + { + this.WaterMetersCount = waterMetersCount; + InitializeComponent(); + SNText = new string[WaterMetersCount]; + Disabled = new bool[WaterMetersCount]; + completed = false; + StartForceCloseHandler(); + + //Height = 55 + WaterMetersCount * 105; + } + + /// Parameterless constructor for 3 watermeters + public CycleBeginningForm() + : this(3) + { + } + + private void CycleBeginningForm_Load(object sender, EventArgs e) + { + Localize(); + + 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.Data; + 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"; + label1.Text = Strings.Serial_Number; + label2.Text = Strings.Serial_Number; + label3.Text = Strings.Serial_Number; + label4.Text = Strings.Serial_Number; + label5.Text = Strings.Serial_Number; + label6.Text = Strings.Serial_Number; + okButton.Text = Strings.OkBtnText; + } + + private void okButton_Click(object sender, EventArgs e) + { + if (WaterMetersCount >= 1) { SNText[0] = textBox1.Text; Disabled[0] = !checkBox1.Checked; } + if (WaterMetersCount >= 2) { SNText[1] = textBox2.Text; Disabled[1] = !checkBox2.Checked; } + if (WaterMetersCount >= 3) { SNText[2] = textBox3.Text; Disabled[2] = !checkBox3.Checked; } + if (WaterMetersCount >= 4) { SNText[3] = textBox4.Text; Disabled[3] = !checkBox4.Checked; } + if (WaterMetersCount >= 5) { SNText[4] = textBox5.Text; Disabled[4] = !checkBox5.Checked; } + if (WaterMetersCount >= 6) { SNText[5] = textBox6.Text; Disabled[5] = !checkBox6.Checked; } + + completed = true; + Close(); + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + checkBox1.Checked = true; + } + + private void textBox2_TextChanged(object sender, EventArgs e) + { + checkBox2.Checked = true; + } + + private void textBox3_TextChanged(object sender, EventArgs e) + { + checkBox3.Checked = true; + } + + private void textBox4_TextChanged(object sender, EventArgs e) + { + checkBox4.Checked = true; + } + + private void textBox5_TextChanged(object sender, EventArgs e) + { + checkBox5.Checked = true; + } + + private void textBox6_TextChanged(object sender, EventArgs e) + { + checkBox6.Checked = true; + } + + #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); + }; + } + + private void OnForceClose(object sender, EventArgs args) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + #endregion + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.resx b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.resx new file mode 100644 index 000000000..6735adac8 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleBeginningForm.resx @@ -0,0 +1,1023 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + Verdana, 14.25pt + + + 506, 38 + + + 98, 63 + + + + 0 + + + OK + + + okButton + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 6 + + + checkBox1 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 + + + textBox1 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 1 + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 2 + + + Verdana, 14.25pt + + + 28, 18 + + + 444, 92 + + + 1 + + + Watermeter 1 + + + groupBox1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + True + + + Verdana, 27.75pt + + + 391, 48 + + + 15, 14 + + + 2 + + + checkBox1 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 + + + 187, 37 + + + 163, 31 + + + 1 + + + textBox1 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 1 + + + True + + + 18, 40 + + + 156, 23 + + + 0 + + + Serial Number: + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 2 + + + checkBox2 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 0 + + + textBox2 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 1 + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 2 + + + Verdana, 14.25pt + + + 28, 123 + + + 444, 92 + + + 2 + + + Watermeter 2 + + + groupBox2 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + True + + + Verdana, 27.75pt + + + + NoControl + + + 391, 48 + + + 15, 14 + + + 7 + + + checkBox2 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 0 + + + 187, 37 + + + 163, 31 + + + 1 + + + textBox2 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 1 + + + True + + + 18, 40 + + + 156, 23 + + + 0 + + + Serial Number: + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 2 + + + checkBox7 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 0 + + + checkBox3 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 1 + + + textBox3 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 2 + + + label3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 3 + + + Verdana, 14.25pt + + + 28, 228 + + + 444, 92 + + + 3 + + + Watermeter 3 + + + groupBox3 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + True + + + Verdana, 27.75pt + + + NoControl + + + 391, -161 + + + 15, 14 + + + 2 + + + checkBox7 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 0 + + + True + + + Verdana, 27.75pt + + + NoControl + + + 391, 48 + + + 15, 14 + + + 7 + + + checkBox3 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 1 + + + 187, 37 + + + 163, 31 + + + 1 + + + textBox3 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 2 + + + True + + + NoControl + + + 18, 40 + + + 156, 23 + + + 0 + + + Serial Number: + + + label3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 3 + + + checkBox4 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 0 + + + textBox4 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 1 + + + label4 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 2 + + + Verdana, 14.25pt + + + 28, 333 + + + 444, 92 + + + 4 + + + Watermeter 4 + + + groupBox4 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + True + + + Verdana, 27.75pt + + + NoControl + + + 391, 48 + + + 15, 14 + + + 7 + + + checkBox4 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 0 + + + 187, 37 + + + 163, 31 + + + 1 + + + textBox4 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 1 + + + True + + + 18, 40 + + + 156, 23 + + + 0 + + + Serial Number: + + + label4 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 2 + + + checkBox5 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 0 + + + textBox5 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 1 + + + label5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 2 + + + Verdana, 14.25pt + + + 28, 438 + + + 444, 92 + + + 5 + + + Watermeter 5 + + + groupBox5 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + True + + + Verdana, 27.75pt + + + NoControl + + + 391, 48 + + + 15, 14 + + + 7 + + + checkBox5 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 0 + + + 187, 37 + + + 163, 31 + + + 1 + + + textBox5 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 1 + + + True + + + 18, 40 + + + 156, 23 + + + 0 + + + Serial Number: + + + label5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 2 + + + True + + + Verdana, 27.75pt + + + NoControl + + + 391, 48 + + + 15, 14 + + + 7 + + + checkBox6 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox6 + + + 0 + + + 187, 37 + + + 163, 31 + + + 1 + + + textBox6 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox6 + + + 1 + + + True + + + 18, 40 + + + 156, 23 + + + 0 + + + Serial Number: + + + label6 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox6 + + + 2 + + + Verdana, 14.25pt + + + 28, 543 + + + 444, 92 + + + 6 + + + Watermeter 6 + + + groupBox6 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + True + + + 6, 13 + + + True + + + 636, 656 + + + Daten + + + CycleBeginningForm + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.Designer.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.Designer.cs new file mode 100644 index 000000000..8c486b18f --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.Designer.cs @@ -0,0 +1,302 @@ +namespace TBF.BenchControl.DataEntry.Standard +{ + partial class CycleEndForm + { + /// + /// 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.textBox2 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.okButton = new System.Windows.Forms.Button(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.textBox6 = new System.Windows.Forms.TextBox(); + this.label6 = 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.textBox2); + this.groupBox2.Controls.Add(this.label2); + 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, 104); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(362, 81); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Wasserzähler 2"; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(183, 31); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(163, 31); + this.textBox2.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(18, 34); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(74, 23); + this.label2.TabIndex = 0; + this.label2.Text = "Stand:"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.textBox1); + this.groupBox1.Controls.Add(this.label1); + 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, 14); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(362, 81); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Wasserzähler 1"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(183, 31); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(163, 31); + this.textBox1.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(18, 34); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(74, 23); + this.label1.TabIndex = 0; + this.label1.Text = "Stand:"; + // + // 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, 23); + 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.textBox3); + this.groupBox3.Controls.Add(this.label3); + 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, 194); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(362, 81); + this.groupBox3.TabIndex = 3; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Wasserzähler 3"; + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(183, 31); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(163, 31); + this.textBox3.TabIndex = 1; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(18, 34); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(74, 23); + this.label3.TabIndex = 0; + this.label3.Text = "Stand:"; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.textBox4); + this.groupBox4.Controls.Add(this.label4); + 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, 284); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(362, 81); + this.groupBox4.TabIndex = 4; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Wasserzähler 4"; + // + // textBox4 + // + this.textBox4.Location = new System.Drawing.Point(183, 31); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(163, 31); + this.textBox4.TabIndex = 1; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(18, 34); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(74, 23); + this.label4.TabIndex = 0; + this.label4.Text = "Stand:"; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.textBox5); + this.groupBox5.Controls.Add(this.label5); + 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, 374); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(362, 81); + this.groupBox5.TabIndex = 5; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "Wasserzähler 5"; + // + // textBox5 + // + this.textBox5.Location = new System.Drawing.Point(183, 31); + this.textBox5.Name = "textBox5"; + this.textBox5.Size = new System.Drawing.Size(163, 31); + this.textBox5.TabIndex = 1; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(18, 34); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(74, 23); + this.label5.TabIndex = 0; + this.label5.Text = "Stand:"; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.textBox6); + this.groupBox6.Controls.Add(this.label6); + 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, 464); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(362, 81); + this.groupBox6.TabIndex = 6; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "Wasserzähler 6"; + // + // textBox6 + // + this.textBox6.Location = new System.Drawing.Point(183, 31); + this.textBox6.Name = "textBox6"; + this.textBox6.Size = new System.Drawing.Size(163, 31); + this.textBox6.TabIndex = 1; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(18, 34); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(74, 23); + this.label6.TabIndex = 0; + this.label6.Text = "Stand:"; + // + // 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, 566); + 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 = "Daten"; + 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 textBox2; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.TextBox textBox5; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.TextBox textBox6; + private System.Windows.Forms.Label label6; + + } +} \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.cs new file mode 100644 index 000000000..2bfd97645 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.cs @@ -0,0 +1,105 @@ +using System; +using System.Windows.Forms; +using log4net; +using TBF.Resources; + +namespace TBF.BenchControl.DataEntry.Standard +{ + public partial class CycleEndForm : Form, GenericDevices.IHasCompleted + { + private static readonly ILog log = LogManager.GetLogger(typeof(CycleEndForm)); + + /// Number of text boxes for serial numbers + public readonly int WaterMetersCount; + + // To be retrieved after the form closes + public string[] EndStateText; + + // Set to 'true' when the form closes + public bool Completed { get { return completed; } } + bool completed; + + /// + /// Constructor + /// + /// Number of text boxes for serial numbers + public CycleEndForm(int waterMetersCount) + { + this.WaterMetersCount = waterMetersCount; + InitializeComponent(); + EndStateText = new string[WaterMetersCount]; + completed = false; + StartForceCloseHandler(); + } + + /// Parameterless constructor for 3 watermeters + public CycleEndForm() + : this(3) + { + } + + private void CycleEndForm_Load(object sender, EventArgs e) + { + Localize(); + + Height = 50 + 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.Data; + 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"; + label1.Text = Strings.State; + label2.Text = Strings.State; + label3.Text = Strings.State; + label4.Text = Strings.State; + label5.Text = Strings.State; + label6.Text = Strings.State; + okButton.Text = Strings.OkBtnText; + } + + private void okButton_Click(object sender, EventArgs e) + { + if (WaterMetersCount >= 1) EndStateText[0] = textBox1.Text; + if (WaterMetersCount >= 2) EndStateText[1] = textBox3.Text; + if (WaterMetersCount >= 3) EndStateText[2] = textBox4.Text; + if (WaterMetersCount >= 4) EndStateText[3] = textBox5.Text; + if (WaterMetersCount >= 5) EndStateText[4] = textBox6.Text; + if (WaterMetersCount >= 6) EndStateText[5] = textBox6.Text; + + 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/CycleEndForm.resx b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/CycleEndForm.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/Standard/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs new file mode 100644 index 000000000..bfeda429a --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using log4net; +using TBF.BenchControl; +using TBF.BenchControl.GenericDevices; + +namespace TBF.BenchControl.DataEntry.Standard +{ + public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm + { + private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm)); + public override string ToString() { return string.Format("DataEntry.Standard({0})", Cfg.ToString(1)); } + + readonly EntryFormCfg entryFormCfg; + + /// + /// Properties set by the Begin and the End form + /// + public string SerialNr(int wmNr) { return string.Empty; } + public float WMState(int wmNr) { return 0; } + + + System.Windows.Forms.Form modelessDlg; + + bool resultSaved; /// Set in Run() when results are saved + + IList waterMeters; /// Passesd as an argument of ShowCycleBeginFormOp/ShowCycleEndFormOp constructor + + public enum CurrentOp + { + None, + ShowFormAtCycleBeginning, + ShowFormAtCycleEnd, + } + + CurrentOp currentOp; + + + public EntryForm(EntryFormCfg cfg) + : base(cfg) + { + entryFormCfg = cfg; + currentOp = CurrentOp.None; + log.Debug(this.ToString()); + } + + /// Reference to the operation + public IOperation ShowCycleBeginFormOp(IList waterMeters) + { + if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); + currentOp = CurrentOp.ShowFormAtCycleBeginning; + this.waterMeters = waterMeters; + return this; + } + + /// Reference to the operation + public IOperation ShowCycleEndFormOp(IList waterMeters) + { + if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); + currentOp = CurrentOp.ShowFormAtCycleEnd; + this.waterMeters = waterMeters; + return this; + } + + /// Reference to the operation + public IOperation ShowWMSNsAndStatesFormOp() + { + return null; + } + + /// Reference to the operation + public IOperation ShowWMStatesFormOp() + { + return null; + } + + delegate void EntryFormDlgt(EntryForm myRef); + /// + void OpenBeginningDlg(EntryForm myRef) + { + myRef.modelessDlg = new CycleBeginningForm(Program.WMsCount); + modelessDlg.Show(); + } + /// + void OpenEndDlg(EntryForm myRef) + { + myRef.modelessDlg = new CycleEndForm(Program.WMsCount); + modelessDlg.Show(); + } + + /// Start this operation + public void Start() + { + resultSaved = false; + switch (currentOp) + { + case CurrentOp.ShowFormAtCycleBeginning: + Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this); + break; + case CurrentOp.ShowFormAtCycleEnd: + Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this); + break; + } + } + + /// Run this operation + /// Event.ResultsPrinted + public Event Run() + { + if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed) + { + return Event.ModelessFormIsOpen; + } + + if (!resultSaved) /// This is to save the result only once + { + if (modelessDlg is CycleBeginningForm) + { + CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm); + int count = Math.Min(dlg.WaterMetersCount, waterMeters.Count); + + if (count > 0 && waterMeters[0] != null) { waterMeters[0].SerialNr = dlg.SNText[0]; waterMeters[0].Disabled = dlg.Disabled[0]; } + if (count > 1 && waterMeters[1] != null) { waterMeters[1].SerialNr = dlg.SNText[1]; waterMeters[1].Disabled = dlg.Disabled[1]; } + if (count > 2 && waterMeters[2] != null) { waterMeters[2].SerialNr = dlg.SNText[2]; waterMeters[2].Disabled = dlg.Disabled[2]; } + if (count > 3 && waterMeters[3] != null) { waterMeters[3].SerialNr = dlg.SNText[3]; waterMeters[3].Disabled = dlg.Disabled[3]; } + if (count > 4 && waterMeters[4] != null) { waterMeters[4].SerialNr = dlg.SNText[4]; waterMeters[4].Disabled = dlg.Disabled[4]; } + if (count > 5 && waterMeters[5] != null) { waterMeters[5].SerialNr = dlg.SNText[5]; waterMeters[5].Disabled = dlg.Disabled[5]; } + } + else if (modelessDlg is CycleEndForm) + { + CycleEndForm dlg = (modelessDlg as CycleEndForm); + int count = Math.Min(dlg.WaterMetersCount, waterMeters.Count); + + if (count > 0 && waterMeters[0] != null) waterMeters[0].EndState = dlg.EndStateText[0]; + if (count > 1 && waterMeters[1] != null) waterMeters[1].EndState = dlg.EndStateText[1]; + if (count > 2 && waterMeters[2] != null) waterMeters[2].EndState = dlg.EndStateText[2]; + if (count > 3 && waterMeters[3] != null) waterMeters[3].EndState = dlg.EndStateText[3]; + if (count > 4 && waterMeters[4] != null) waterMeters[4].EndState = dlg.EndStateText[4]; + if (count > 5 && waterMeters[5] != null) waterMeters[5].EndState = dlg.EndStateText[5]; + } + resultSaved = true; + modelessDlg = null; + } + + return Event.ModelessFormClosed; /// Form closed + } + + /// Stop this operation + public void Stop() + { + if (modelessDlg is IHasCompleted) + { + UiBridge.Bridge.OnCloseModelessForm(this, null); + modelessDlg = null; + } + currentOp = CurrentOp.None; + } + + /// + /// Updates test results with the information collected in watermeters. + /// + /// Watermetes with information entered in the forms + /// Test results to be updated with the information + public void UpdateTestResults(IList waterMeters, IList results) + { + foreach (var test in results) + { + if (test.MetersKind != Entities.MetersKind.Single) continue; + + int nrMtrsToUpdate = Math.Max(waterMeters.Count, test.Meters.Count); + for (int i = 0; i < nrMtrsToUpdate; i++) + { + test.Meters[i].SerialNr = waterMeters[i].SerialNr; + test.Meters[i].EndState = waterMeters[i].EndState; + } + } + } + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfg.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfg.cs new file mode 100644 index 000000000..c591c4b82 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfg.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.Serialization; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataEntry.Standard +{ + public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg + { + public IComponent GetComponent(IList components) { return new EntryForm(this); } + public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); } + + /// + /// Serialized parameters + /// + public string ProtocolTitle1; + public string ProtocolTitle2; + public string ProtocolTitle3; + + /// Private parameterless constructor invoked by all other (public) constructors + EntryFormCfg() + { + Name = "DataEntryForm-3"; + ParentName = string.Empty; + ProtocolTitle1 = "Protokoll Werkprüfung"; + ProtocolTitle2 = "Protokoll 2"; + ProtocolTitle3 = "Protokoll 3"; + } + + public EntryFormCfg(IComponentFactory factory) + : this() + { + this.Factory = factory; + } + + public string ToString(int i) + { + return string.Format("Name={0}, Protocol1={1}, Protocol2={2}, Protocol3={3}", + Name, + (string.IsNullOrEmpty(ProtocolTitle1) ? "-" : ProtocolTitle1), + (string.IsNullOrEmpty(ProtocolTitle2) ? "-" : ProtocolTitle2), + (string.IsNullOrEmpty(ProtocolTitle3) ? "-" : ProtocolTitle3)); + } + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.cs new file mode 100644 index 000000000..458c8b343 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.cs @@ -0,0 +1,77 @@ +using System; +using System.Windows.Forms; +using log4net; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataEntry.Standard +{ + public partial class EntryFormCfgCtrl : UserControl, IComponentCfgCtrl + { + static readonly ILog log = LogManager.GetLogger(typeof(EntryFormCfgCtrl)); + + public bool ShowMore { get { return false; } } + + EntryFormCfg config; + public IComponentCfg Config + { + get { return config as IComponentCfg; } + set + { + config = value as EntryFormCfg; + Redraw(); + } + } + + public EntryFormCfgCtrl() + { + InitializeComponent(); + } + + private void EntryFormCfgCtrl_Load(object sender, EventArgs e) + { + Redraw(); + } + + public void Closing() + { + } + + void Redraw() + { + if (config == null) return; /// Control was not loaded, settings were not changed + classNameLabel.Text = config.Factory.ClassName; + nameTextBox.Text = config.Name; + protocolTitle1TextBox.Text = config.ProtocolTitle1; + protocolTitle2TextBox.Text = config.ProtocolTitle2; + protocolTitle3TextBox.Text = config.ProtocolTitle3; + } + + public void Unlock() + { + nameTextBox.Enabled = true; + protocolTitle1TextBox.Enabled = true; + protocolTitle2TextBox.Enabled = true; + protocolTitle3TextBox.Enabled = true; + } + + public CfgUpdateFlags VerifyCfg(ref string message) + { + CfgUpdateFlags flags = CfgUpdateFlags.None; + return flags; + } + + public CfgUpdateFlags UpdateCfg() + { + CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; + + if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed + + config.Name = nameTextBox.Text; + config.ProtocolTitle1 = protocolTitle1TextBox.Text; + config.ProtocolTitle2 = protocolTitle2TextBox.Text; + config.ProtocolTitle3 = protocolTitle3TextBox.Text; + + return flags; + } + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.designer.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.designer.cs new file mode 100644 index 000000000..e1c57ea03 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.designer.cs @@ -0,0 +1,152 @@ +namespace TBF.BenchControl.DataEntry.Standard +{ + partial class EntryFormCfgCtrl + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.protocolTitle1TextBox = new System.Windows.Forms.TextBox(); + this.protocolTitle2TextBox = new System.Windows.Forms.TextBox(); + this.protocolTitle3TextBox = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // nameTextBox + // + this.nameTextBox.Enabled = false; + this.nameTextBox.Location = new System.Drawing.Point(137, 57); + this.nameTextBox.Name = "nameTextBox"; + this.nameTextBox.Size = new System.Drawing.Size(130, 20); + this.nameTextBox.TabIndex = 5; + // + // nameLabel + // + this.nameLabel.AutoSize = true; + this.nameLabel.Location = new System.Drawing.Point(27, 60); + this.nameLabel.Name = "nameLabel"; + this.nameLabel.Size = new System.Drawing.Size(35, 13); + this.nameLabel.TabIndex = 4; + this.nameLabel.Text = "Name"; + // + // classNameLabel + // + this.classNameLabel.AutoSize = true; + this.classNameLabel.Location = new System.Drawing.Point(134, 33); + this.classNameLabel.Name = "classNameLabel"; + this.classNameLabel.Size = new System.Drawing.Size(83, 13); + this.classNameLabel.TabIndex = 3; + this.classNameLabel.Text = "ComonentName"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(27, 86); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(74, 13); + this.label1.TabIndex = 6; + this.label1.Text = "Protocol title 1"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(27, 112); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(74, 13); + this.label2.TabIndex = 7; + this.label2.Text = "Protocol title 2"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(27, 138); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(74, 13); + this.label3.TabIndex = 8; + this.label3.Text = "Protocol title 3"; + // + // protocolTitle1TextBox + // + this.protocolTitle1TextBox.Enabled = false; + this.protocolTitle1TextBox.Location = new System.Drawing.Point(137, 83); + this.protocolTitle1TextBox.Name = "protocolTitle1TextBox"; + this.protocolTitle1TextBox.Size = new System.Drawing.Size(130, 20); + this.protocolTitle1TextBox.TabIndex = 9; + // + // protocolTitle2TextBox + // + this.protocolTitle2TextBox.Enabled = false; + this.protocolTitle2TextBox.Location = new System.Drawing.Point(137, 109); + this.protocolTitle2TextBox.Name = "protocolTitle2TextBox"; + this.protocolTitle2TextBox.Size = new System.Drawing.Size(130, 20); + this.protocolTitle2TextBox.TabIndex = 10; + // + // protocolTitle3TextBox + // + this.protocolTitle3TextBox.Enabled = false; + this.protocolTitle3TextBox.Location = new System.Drawing.Point(137, 135); + this.protocolTitle3TextBox.Name = "protocolTitle3TextBox"; + this.protocolTitle3TextBox.Size = new System.Drawing.Size(130, 20); + this.protocolTitle3TextBox.TabIndex = 11; + // + // EntryFormCfgCtrl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.protocolTitle3TextBox); + this.Controls.Add(this.protocolTitle2TextBox); + this.Controls.Add(this.protocolTitle1TextBox); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + 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(); + + } + + #endregion + + private System.Windows.Forms.TextBox nameTextBox; + private System.Windows.Forms.Label nameLabel; + private System.Windows.Forms.Label classNameLabel; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox protocolTitle1TextBox; + private System.Windows.Forms.TextBox protocolTitle2TextBox; + private System.Windows.Forms.TextBox protocolTitle3TextBox; + } +} diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.resx b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormCfgCtrl.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/Standard/EntryFormFactory.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormFactory.cs new file mode 100644 index 000000000..3e708ebb7 --- /dev/null +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryFormFactory.cs @@ -0,0 +1,18 @@ +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataEntry.Standard +{ + public class EntryFormFactory : IComponentFactory + { + public string ClassName { get { return "DataEntry-Standard"; } } + + public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this); + } + } +} diff --git a/TestBenchFramework/BenchControl/GenericDevices/IWaterMeter.cs b/TestBenchFramework/BenchControl/GenericDevices/IWaterMeter.cs index 7ec5679db..52302d003 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/IWaterMeter.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/IWaterMeter.cs @@ -10,5 +10,6 @@ namespace TBF.BenchControl.GenericDevices string MetrologicalClass { get; } string SerialNr { get; set; } string EndState { get; set; } + bool Disabled { get; set; } /// Set to true to hide this watermeter results } } diff --git a/TestBenchFramework/BenchControl/WaterMeter/WaterMeter.cs b/TestBenchFramework/BenchControl/WaterMeter/WaterMeter.cs index ca3e03cf6..51b937f5f 100644 --- a/TestBenchFramework/BenchControl/WaterMeter/WaterMeter.cs +++ b/TestBenchFramework/BenchControl/WaterMeter/WaterMeter.cs @@ -49,6 +49,13 @@ namespace TBF.BenchControl.WaterMeter } string beginState; + public bool Disabled + { + get { return disabled; } + set { disabled = value; } + } + bool disabled; + public WaterMeter(WaterMeterCfg cfg) : base(cfg) { diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index bc34a3544..a2b56a09b 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -172,6 +172,27 @@ PumpCfgCtrl.cs + + Form + + + CycleBeginningForm.cs + + + Form + + + CycleEndForm.cs + + + + + UserControl + + + EntryFormCfgCtrl.cs + + Form @@ -214,6 +235,27 @@ EntryFormCfgCtrl.cs + + Form + + + CycleBeginningForm.cs + + + Form + + + CycleEndForm.cs + + + + + UserControl + + + EntryFormCfgCtrl.cs + + Form @@ -1025,6 +1067,15 @@ PumpCfgCtrl.cs + + CycleBeginningForm.cs + + + CycleEndForm.cs + + + EntryFormCfgCtrl.cs + CycleBeginningForm.cs @@ -1043,6 +1094,15 @@ EntryFormCfgCtrl.cs + + CycleBeginningForm.cs + + + CycleEndForm.cs + + + EntryFormCfgCtrl.cs + WMSNsAndStatesForm.cs