diff --git a/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs b/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs new file mode 100644 index 000000000..6638792de --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs @@ -0,0 +1,216 @@ +/// +/// Copyright (c) 2013-2017 Sensus Metering Systems +/// +using System; +using System.Collections.Generic; +using log4net; +using Config.Entities; +using TBF.BenchControl; +using TBF.BenchControl.GenericDevices; + +namespace TBF.BenchControl.DataEntry.WMStates +{ + public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasWMStatesForm + { + private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm)); + public override string ToString() { return string.Format("DataEntry.WMStates({0})", Cfg.ToString(1)); } + + public bool UsesCameras() { return false; } + + readonly EntryFormCfg entryFormCfg; + IRegReader[] regReaders; + + /// + /// Test start water meter states set by forms + /// + double[] wmStartState; + public double WMStartState(int wmNr) + { + if (wmStartState == null || wmStartState.Length <= wmNr) return 0; + return wmStartState[wmNr]; + } + + /// + /// Test end water meter states set by forms + /// + double[] wmEndState; + public double WMEndState(int wmNr) + { + if (wmEndState == null || wmEndState.Length <= wmNr) return 0; + return wmEndState[wmNr]; + } + + /// Not supported + public void UpdateTestResults(Results.BatchResults results) + { + } + + + System.Windows.Forms.Form modelessDlg; + public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } } + + bool resultSaved; + + public enum CurrentOp + { + None, + EnterWMSNsAndStates, + EnterTestStartStates, + EnterTestEndStates, + } + + CurrentOp currentOp; + + + public EntryForm() + { + } + + public EntryForm(Generic.IComponentCfg cfg) + : base(cfg) + { + entryFormCfg = cfg as EntryFormCfg; + wmStartState = new double[Config.Data.WMsCount]; + currentOp = CurrentOp.None; + log.Debug(this.ToString()); + } + + /// Reference to the operation + public IOperation ShowCycleBeginFormOp(IList waterMeters) + { + return null; + } + + /// Reference to the operation + public IOperation ShowCycleEndFormOp(IList waterMeters) + { + return null; + } + + /// Reference to the operation + public IOperation ShowWMSNsAndStatesFormOp() + { + if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); + currentOp = CurrentOp.EnterWMSNsAndStates; + return this; + } + + /// Reference to the operation + public IOperation ShowTestStartFormOp(IRegReader[] regReaders) + { + if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); + currentOp = CurrentOp.EnterTestStartStates; + this.regReaders = regReaders; + return this; + } + + /// Reference to the operation + public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi) + { + if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); + currentOp = CurrentOp.EnterTestEndStates; + return this; + } + + delegate void EntryFormDlgt(EntryForm myRef); + /// + void OpenWMSNsAndStatesDlg(EntryForm myRef) + { + myRef.modelessDlg = new WMSNsAndStatesForm(Config.Data.WMsCount); + modelessDlg.Show(); + } + /// + void OpenWMStatesDlg(EntryForm myRef) + { + myRef.modelessDlg = new WMStatesForm(Config.Data.WMsCount); + modelessDlg.Show(); + } + + /// Start this operation + public void Start() + { + resultSaved = false; + switch (currentOp) + { + case CurrentOp.EnterWMSNsAndStates: + Program.MainWnd.Invoke(new EntryFormDlgt(OpenWMSNsAndStatesDlg), this); + break; + case CurrentOp.EnterTestStartStates: + Program.MainWnd.Invoke(new EntryFormDlgt(OpenWMStatesDlg), this); + break; + case CurrentOp.EnterTestEndStates: + Program.MainWnd.Invoke(new EntryFormDlgt(OpenWMStatesDlg), 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 WMSNsAndStatesForm) + { + WMSNsAndStatesForm dlg = (modelessDlg as WMSNsAndStatesForm); + + if (dlg.WaterMetersCount > 0) wmStartState[0] = dlg.WMState[0]; + if (dlg.WaterMetersCount > 1) wmStartState[1] = dlg.WMState[1]; + if (dlg.WaterMetersCount > 2) wmStartState[2] = dlg.WMState[2]; + if (dlg.WaterMetersCount > 3) wmStartState[3] = dlg.WMState[3]; + if (dlg.WaterMetersCount > 4) wmStartState[4] = dlg.WMState[4]; + if (dlg.WaterMetersCount > 5) wmStartState[5] = dlg.WMState[5]; + + //if (dlg.WaterMetersCount > 0) serialNr[0] = dlg.SNText[0]; + //if (dlg.WaterMetersCount > 1) serialNr[1] = dlg.SNText[1]; + //if (dlg.WaterMetersCount > 2) serialNr[2] = dlg.SNText[2]; + //if (dlg.WaterMetersCount > 3) serialNr[3] = dlg.SNText[3]; + //if (dlg.WaterMetersCount > 4) serialNr[4] = dlg.SNText[4]; + //if (dlg.WaterMetersCount > 5) serialNr[5] = dlg.SNText[5]; + } + else if (modelessDlg is WMStatesForm && currentOp == CurrentOp.EnterTestStartStates) + { + WMStatesForm dlg = (modelessDlg as WMStatesForm); + + if (dlg.WaterMetersCount > 0) wmStartState[0] = dlg.WMState[0]; + if (dlg.WaterMetersCount > 1) wmStartState[1] = dlg.WMState[1]; + if (dlg.WaterMetersCount > 2) wmStartState[2] = dlg.WMState[2]; + if (dlg.WaterMetersCount > 3) wmStartState[3] = dlg.WMState[3]; + if (dlg.WaterMetersCount > 4) wmStartState[4] = dlg.WMState[4]; + if (dlg.WaterMetersCount > 5) wmStartState[5] = dlg.WMState[5]; + } + else if (modelessDlg is WMStatesForm && currentOp == CurrentOp.EnterTestEndStates) + { + WMStatesForm dlg = (modelessDlg as WMStatesForm); + + if (dlg.WaterMetersCount > 0) wmEndState[0] = dlg.WMState[0]; + if (dlg.WaterMetersCount > 1) wmEndState[1] = dlg.WMState[1]; + if (dlg.WaterMetersCount > 2) wmEndState[2] = dlg.WMState[2]; + if (dlg.WaterMetersCount > 3) wmEndState[3] = dlg.WMState[3]; + if (dlg.WaterMetersCount > 4) wmEndState[4] = dlg.WMState[4]; + if (dlg.WaterMetersCount > 5) wmEndState[5] = dlg.WMState[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; + } + } +} diff --git a/TBF/BenchControl/DataEntry/WMStates/EntryFormCfg.cs b/TBF/BenchControl/DataEntry/WMStates/EntryFormCfg.cs new file mode 100644 index 000000000..99aec5436 --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/EntryFormCfg.cs @@ -0,0 +1,37 @@ +/// +/// Copyright (c) 2013-2016 Sensus Metering Systems +/// +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.Serialization; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataEntry.WMStates +{ + public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg + { + public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0]; + public override XmlSerializer GetSerializer() { return Serializer; } + + public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); } + + /// Private parameterless constructor invoked by all other (public) constructors + EntryFormCfg() + { + Name = "Generic-WM-States-Form"; + ParentName = string.Empty; + } + + public EntryFormCfg(IComponentFactory factory) + : this() + { + this.Factory = factory; + } + + public string ToString(int i) + { + return string.Format("Name={0}", Name); + } + } +} diff --git a/TBF/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.cs b/TBF/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.cs new file mode 100644 index 000000000..182fd9321 --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.cs @@ -0,0 +1,69 @@ +/// +/// Copyright (c) 2013-2015 Sensus Metering Systems +/// +using System; +using System.Windows.Forms; +using Config.Entities; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataEntry.WMStates +{ + public partial class EntryFormCfgCtrl : UserControl, IComponentCfgCtrl + { + 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; + } + + public void Unlock() + { + nameTextBox.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; + + return flags; + } + } +} diff --git a/TBF/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.designer.cs b/TBF/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.designer.cs new file mode 100644 index 000000000..1b5df36a9 --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.designer.cs @@ -0,0 +1,86 @@ +/// +/// Copyright (c) 2013-2015 Sensus Metering Systems +/// +namespace TBF.BenchControl.DataEntry.WMStates +{ + 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.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"; + // + // EntryFormCfgCtrl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + 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; + } +} diff --git a/TBF/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.resx b/TBF/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/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/TBF/BenchControl/DataEntry/WMStates/EntryFormFactory.cs b/TBF/BenchControl/DataEntry/WMStates/EntryFormFactory.cs new file mode 100644 index 000000000..fd77c2e22 --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/EntryFormFactory.cs @@ -0,0 +1,26 @@ +/// +/// Copyright (c) 2013-2016 Sensus Metering Systems +/// +using System.Collections.Generic; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataEntry.WMStates +{ + public class EntryFormFactory : IComponentFactory + { + public string ClassName { get { return "Generic-WM-States-Form"; } } + + public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); } + + public IComponent DummyComponent() { return new EntryForm(); } + + public IComponent GetComponent(IComponentCfg cfg, IList components) { return new EntryForm(cfg); } + + public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this); + } + } +} diff --git a/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.cs b/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.cs new file mode 100644 index 000000000..6b56038f6 --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.cs @@ -0,0 +1,135 @@ +/// +/// Copyright (c) 2013-2015 Sensus Metering Systems +/// +using System; +using System.Windows.Forms; +using log4net; +using TBF.Resources; + +namespace TBF.BenchControl.DataEntry.WMStates +{ + public partial class WMSNsAndStatesForm : Form, GenericDevices.IHasCompleted + { + private static readonly ILog log = LogManager.GetLogger(typeof(WMSNsAndStatesForm)); + + /// Number of text boxes for serial numbers + public readonly int WaterMetersCount; + + /// To be retrieved after the form is closed + public string[] SNText; + + // To be retrieved after the form closes + public float[] WMState; + + /// Set to 'true' when the form closes + public bool Completed { get { return completed; } } + bool completed; + + /// + /// Constructor + /// + /// Number of text boxes for serial numbers + public WMSNsAndStatesForm(int waterMetersCount) + { + InitializeComponent(); + ControlBox = false; + + this.WaterMetersCount = waterMetersCount; + SNText = new string[WaterMetersCount]; + WMState = new float[WaterMetersCount]; + + completed = false; + StartForceCloseHandler(); + + //Height = 55 + WaterMetersCount * 105; + } + + /// Parameterless constructor for 3 watermeters + public WMSNsAndStatesForm() + : this(Config.Data.WMsCount) + { + } + + void Localize() + { + Text = Strings.Water_Meter_SNs_States; + groupBox1.Text = Strings.Water_Meter + " 1"; + groupBox2.Text = Strings.Water_Meter + " 2"; + groupBox3.Text = Strings.Water_Meter + " 3"; + groupBox4.Text = Strings.Water_Meter + " 4"; + groupBox5.Text = Strings.Water_Meter + " 5"; + groupBox6.Text = Strings.Water_Meter + " 6"; + snLabel1.Text = Strings.SerialNr; + snLabel2.Text = Strings.SerialNr; + snLabel3.Text = Strings.SerialNr; + snLabel4.Text = Strings.SerialNr; + snLabel5.Text = Strings.SerialNr; + snLabel6.Text = Strings.SerialNr; + wmStateLabel1.Text = Strings.WMState; + wmStateLabel2.Text = Strings.WMState; + wmStateLabel3.Text = Strings.WMState; + wmStateLabel4.Text = Strings.WMState; + wmStateLabel5.Text = Strings.WMState; + wmStateLabel6.Text = Strings.WMState; + okButton.Text = Strings.OkBtnText; + } + + private void CycleBeginningForm_Load(object sender, EventArgs e) + { + // TODO: localize strings + + 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; + } + + private void okButton_Click(object sender, EventArgs e) + { + try + { + if (WaterMetersCount >= 1) SNText[0] = snTextBox1.Text; + if (WaterMetersCount >= 2) SNText[1] = snTextBox2.Text; + if (WaterMetersCount >= 3) SNText[2] = snTextBox3.Text; + if (WaterMetersCount >= 4) SNText[3] = snTextBox4.Text; + if (WaterMetersCount >= 5) SNText[4] = snTextBox5.Text; + if (WaterMetersCount >= 6) SNText[5] = snTextBox6.Text; + + if (WaterMetersCount >= 1) WMState[0] = Utils.ParseUFloat(wmStateTextBox1.Text); + if (WaterMetersCount >= 2) WMState[1] = Utils.ParseUFloat(wmStateTextBox2.Text); + if (WaterMetersCount >= 3) WMState[2] = Utils.ParseUFloat(wmStateTextBox3.Text); + if (WaterMetersCount >= 4) WMState[3] = Utils.ParseUFloat(wmStateTextBox4.Text); + if (WaterMetersCount >= 5) WMState[4] = Utils.ParseUFloat(wmStateTextBox5.Text); + if (WaterMetersCount >= 6) WMState[5] = Utils.ParseUFloat(wmStateTextBox6.Text); + } + catch + { + return; + } + + completed = true; + Close(); + } + + #region Forced close handling + + public void StartForceCloseHandler() + { + UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args) + { + if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); } + else OnForceClose(sender, args); + }; + } + + void OnForceClose(object sender, EventArgs args) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + #endregion + } +} diff --git a/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.designer.cs b/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.designer.cs new file mode 100644 index 000000000..662c6d7bd --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.designer.cs @@ -0,0 +1,335 @@ +/// +/// Copyright (c) 2013-2015 Sensus Metering Systems +/// +namespace TBF.BenchControl.DataEntry.WMStates +{ + partial class WMSNsAndStatesForm + { + /// + /// 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(WMSNsAndStatesForm)); + this.okButton = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox1 = new System.Windows.Forms.TextBox(); + this.wmStateLabel1 = new System.Windows.Forms.Label(); + this.snTextBox1 = new System.Windows.Forms.TextBox(); + this.snLabel1 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox2 = new System.Windows.Forms.TextBox(); + this.wmStateLabel2 = new System.Windows.Forms.Label(); + this.snTextBox2 = new System.Windows.Forms.TextBox(); + this.snLabel2 = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox3 = new System.Windows.Forms.TextBox(); + this.wmStateLabel3 = new System.Windows.Forms.Label(); + this.snTextBox3 = new System.Windows.Forms.TextBox(); + this.snLabel3 = new System.Windows.Forms.Label(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox4 = new System.Windows.Forms.TextBox(); + this.wmStateLabel4 = new System.Windows.Forms.Label(); + this.snTextBox4 = new System.Windows.Forms.TextBox(); + this.snLabel4 = new System.Windows.Forms.Label(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox5 = new System.Windows.Forms.TextBox(); + this.wmStateLabel5 = new System.Windows.Forms.Label(); + this.snTextBox5 = new System.Windows.Forms.TextBox(); + this.snLabel5 = new System.Windows.Forms.Label(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox6 = new System.Windows.Forms.TextBox(); + this.wmStateLabel6 = new System.Windows.Forms.Label(); + this.snTextBox6 = new System.Windows.Forms.TextBox(); + this.snLabel6 = 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.wmStateTextBox1); + this.groupBox1.Controls.Add(this.wmStateLabel1); + this.groupBox1.Controls.Add(this.snTextBox1); + this.groupBox1.Controls.Add(this.snLabel1); + resources.ApplyResources(this.groupBox1, "groupBox1"); + this.groupBox1.ForeColor = System.Drawing.Color.Black; + this.groupBox1.Name = "groupBox1"; + this.groupBox1.TabStop = false; + // + // wmStateTextBox1 + // + resources.ApplyResources(this.wmStateTextBox1, "wmStateTextBox1"); + this.wmStateTextBox1.Name = "wmStateTextBox1"; + // + // wmStateLabel1 + // + resources.ApplyResources(this.wmStateLabel1, "wmStateLabel1"); + this.wmStateLabel1.Name = "wmStateLabel1"; + // + // snTextBox1 + // + resources.ApplyResources(this.snTextBox1, "snTextBox1"); + this.snTextBox1.Name = "snTextBox1"; + // + // snLabel1 + // + resources.ApplyResources(this.snLabel1, "snLabel1"); + this.snLabel1.Name = "snLabel1"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.wmStateTextBox2); + this.groupBox2.Controls.Add(this.wmStateLabel2); + this.groupBox2.Controls.Add(this.snTextBox2); + this.groupBox2.Controls.Add(this.snLabel2); + resources.ApplyResources(this.groupBox2, "groupBox2"); + this.groupBox2.ForeColor = System.Drawing.Color.Black; + this.groupBox2.Name = "groupBox2"; + this.groupBox2.TabStop = false; + // + // wmStateTextBox2 + // + resources.ApplyResources(this.wmStateTextBox2, "wmStateTextBox2"); + this.wmStateTextBox2.Name = "wmStateTextBox2"; + // + // wmStateLabel2 + // + resources.ApplyResources(this.wmStateLabel2, "wmStateLabel2"); + this.wmStateLabel2.Name = "wmStateLabel2"; + // + // snTextBox2 + // + resources.ApplyResources(this.snTextBox2, "snTextBox2"); + this.snTextBox2.Name = "snTextBox2"; + // + // snLabel2 + // + resources.ApplyResources(this.snLabel2, "snLabel2"); + this.snLabel2.Name = "snLabel2"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.wmStateTextBox3); + this.groupBox3.Controls.Add(this.wmStateLabel3); + this.groupBox3.Controls.Add(this.snTextBox3); + this.groupBox3.Controls.Add(this.snLabel3); + resources.ApplyResources(this.groupBox3, "groupBox3"); + this.groupBox3.ForeColor = System.Drawing.Color.Black; + this.groupBox3.Name = "groupBox3"; + this.groupBox3.TabStop = false; + // + // wmStateTextBox3 + // + resources.ApplyResources(this.wmStateTextBox3, "wmStateTextBox3"); + this.wmStateTextBox3.Name = "wmStateTextBox3"; + // + // wmStateLabel3 + // + resources.ApplyResources(this.wmStateLabel3, "wmStateLabel3"); + this.wmStateLabel3.Name = "wmStateLabel3"; + // + // snTextBox3 + // + resources.ApplyResources(this.snTextBox3, "snTextBox3"); + this.snTextBox3.Name = "snTextBox3"; + // + // snLabel3 + // + resources.ApplyResources(this.snLabel3, "snLabel3"); + this.snLabel3.Name = "snLabel3"; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.wmStateTextBox4); + this.groupBox4.Controls.Add(this.wmStateLabel4); + this.groupBox4.Controls.Add(this.snTextBox4); + this.groupBox4.Controls.Add(this.snLabel4); + resources.ApplyResources(this.groupBox4, "groupBox4"); + this.groupBox4.ForeColor = System.Drawing.Color.Black; + this.groupBox4.Name = "groupBox4"; + this.groupBox4.TabStop = false; + // + // wmStateTextBox4 + // + resources.ApplyResources(this.wmStateTextBox4, "wmStateTextBox4"); + this.wmStateTextBox4.Name = "wmStateTextBox4"; + // + // wmStateLabel4 + // + resources.ApplyResources(this.wmStateLabel4, "wmStateLabel4"); + this.wmStateLabel4.Name = "wmStateLabel4"; + // + // snTextBox4 + // + resources.ApplyResources(this.snTextBox4, "snTextBox4"); + this.snTextBox4.Name = "snTextBox4"; + // + // snLabel4 + // + resources.ApplyResources(this.snLabel4, "snLabel4"); + this.snLabel4.Name = "snLabel4"; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.wmStateTextBox5); + this.groupBox5.Controls.Add(this.wmStateLabel5); + this.groupBox5.Controls.Add(this.snTextBox5); + this.groupBox5.Controls.Add(this.snLabel5); + resources.ApplyResources(this.groupBox5, "groupBox5"); + this.groupBox5.ForeColor = System.Drawing.Color.Black; + this.groupBox5.Name = "groupBox5"; + this.groupBox5.TabStop = false; + // + // wmStateTextBox5 + // + resources.ApplyResources(this.wmStateTextBox5, "wmStateTextBox5"); + this.wmStateTextBox5.Name = "wmStateTextBox5"; + // + // wmStateLabel5 + // + resources.ApplyResources(this.wmStateLabel5, "wmStateLabel5"); + this.wmStateLabel5.Name = "wmStateLabel5"; + // + // snTextBox5 + // + resources.ApplyResources(this.snTextBox5, "snTextBox5"); + this.snTextBox5.Name = "snTextBox5"; + // + // snLabel5 + // + resources.ApplyResources(this.snLabel5, "snLabel5"); + this.snLabel5.Name = "snLabel5"; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.wmStateTextBox6); + this.groupBox6.Controls.Add(this.wmStateLabel6); + this.groupBox6.Controls.Add(this.snTextBox6); + this.groupBox6.Controls.Add(this.snLabel6); + resources.ApplyResources(this.groupBox6, "groupBox6"); + this.groupBox6.ForeColor = System.Drawing.Color.Black; + this.groupBox6.Name = "groupBox6"; + this.groupBox6.TabStop = false; + // + // wmStateTextBox6 + // + resources.ApplyResources(this.wmStateTextBox6, "wmStateTextBox6"); + this.wmStateTextBox6.Name = "wmStateTextBox6"; + // + // wmStateLabel6 + // + resources.ApplyResources(this.wmStateLabel6, "wmStateLabel6"); + this.wmStateLabel6.Name = "wmStateLabel6"; + // + // snTextBox6 + // + resources.ApplyResources(this.snTextBox6, "snTextBox6"); + this.snTextBox6.Name = "snTextBox6"; + // + // snLabel6 + // + resources.ApplyResources(this.snLabel6, "snLabel6"); + this.snLabel6.Name = "snLabel6"; + // + // WMSNsAndStatesForm + // + 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 = "WMSNsAndStatesForm"; + 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 snLabel1; + private System.Windows.Forms.TextBox snTextBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox snTextBox2; + private System.Windows.Forms.Label snLabel2; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox snTextBox3; + private System.Windows.Forms.Label snLabel3; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.TextBox snTextBox4; + private System.Windows.Forms.Label snLabel4; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.TextBox snTextBox5; + private System.Windows.Forms.Label snLabel5; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.TextBox snTextBox6; + private System.Windows.Forms.Label snLabel6; + private System.Windows.Forms.TextBox wmStateTextBox1; + private System.Windows.Forms.Label wmStateLabel1; + private System.Windows.Forms.TextBox wmStateTextBox2; + private System.Windows.Forms.Label wmStateLabel2; + private System.Windows.Forms.TextBox wmStateTextBox3; + private System.Windows.Forms.Label wmStateLabel3; + private System.Windows.Forms.TextBox wmStateTextBox4; + private System.Windows.Forms.Label wmStateLabel4; + private System.Windows.Forms.TextBox wmStateTextBox5; + private System.Windows.Forms.Label wmStateLabel5; + private System.Windows.Forms.TextBox wmStateTextBox6; + private System.Windows.Forms.Label wmStateLabel6; + } +} \ No newline at end of file diff --git a/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.resx b/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.resx new file mode 100644 index 000000000..ad22c6695 --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/WMSNsAndStatesForm.resx @@ -0,0 +1,924 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 640, 27 + + + 98, 63 + + + + 0 + + + OK + + + okButton + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 6 + + + 386, 37 + + + 163, 31 + + + 3 + + + wmStateTextBox1 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 + + + True + + + 302, 40 + + + 68, 23 + + + 2 + + + State: + + + wmStateLabel1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 1 + + + 100, 37 + + + 163, 31 + + + 1 + + + snTextBox1 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 2 + + + True + + + 38, 40 + + + 55, 23 + + + 0 + + + S/N: + + + snLabel1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 3 + + + Verdana, 14.25pt + + + 28, 18 + + + 575, 92 + + + 1 + + + Water Meter 1 + + + groupBox1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + 386, 37 + + + 163, 31 + + + 3 + + + wmStateTextBox2 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 0 + + + True + + + + NoControl + + + 302, 40 + + + 68, 23 + + + 2 + + + State: + + + wmStateLabel2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 1 + + + 100, 37 + + + 163, 31 + + + 1 + + + snTextBox2 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 2 + + + True + + + 38, 40 + + + 55, 23 + + + 0 + + + S/N: + + + snLabel2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 3 + + + Verdana, 14.25pt + + + 28, 123 + + + 575, 92 + + + 2 + + + Water Meter 2 + + + groupBox2 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + 386, 37 + + + 163, 31 + + + 3 + + + wmStateTextBox3 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 0 + + + True + + + NoControl + + + 302, 40 + + + 68, 23 + + + 2 + + + State: + + + wmStateLabel3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 1 + + + 100, 37 + + + 163, 31 + + + 1 + + + snTextBox3 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 2 + + + True + + + 38, 40 + + + 55, 23 + + + 0 + + + S/N: + + + snLabel3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 3 + + + Verdana, 14.25pt + + + 28, 228 + + + 575, 92 + + + 3 + + + Water Meter 3 + + + groupBox3 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + 386, 37 + + + 163, 31 + + + 3 + + + wmStateTextBox4 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 0 + + + True + + + NoControl + + + 302, 40 + + + 68, 23 + + + 2 + + + State: + + + wmStateLabel4 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 1 + + + 100, 37 + + + 163, 31 + + + 1 + + + snTextBox4 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 2 + + + True + + + 38, 40 + + + 55, 23 + + + 0 + + + S/N: + + + snLabel4 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 3 + + + Verdana, 14.25pt + + + 28, 333 + + + 575, 92 + + + 4 + + + Water Meter 4 + + + groupBox4 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + 386, 32 + + + 163, 31 + + + 3 + + + wmStateTextBox5 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 0 + + + True + + + NoControl + + + 302, 35 + + + 68, 23 + + + 2 + + + State: + + + wmStateLabel5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 1 + + + 100, 37 + + + 163, 31 + + + 1 + + + snTextBox5 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 2 + + + True + + + 38, 40 + + + 55, 23 + + + 0 + + + S/N: + + + snLabel5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 3 + + + Verdana, 14.25pt + + + 28, 438 + + + 575, 92 + + + 5 + + + Water Meter 5 + + + groupBox5 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + 386, 37 + + + 163, 31 + + + 3 + + + wmStateTextBox6 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox6 + + + 0 + + + True + + + NoControl + + + 302, 40 + + + 68, 23 + + + 2 + + + State: + + + wmStateLabel6 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox6 + + + 1 + + + 100, 37 + + + 163, 31 + + + 1 + + + snTextBox6 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox6 + + + 2 + + + True + + + 38, 40 + + + 55, 23 + + + 0 + + + S/N: + + + snLabel6 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox6 + + + 3 + + + Verdana, 14.25pt + + + 28, 543 + + + 575, 92 + + + 6 + + + Water Meter 6 + + + groupBox6 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + True + + + 6, 13 + + + True + + + 773, 661 + + + Water Meter Serial Numbers and States + + + WMSNsAndStatesForm + + + 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/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.cs b/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.cs new file mode 100644 index 000000000..1ab050c75 --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.cs @@ -0,0 +1,118 @@ +/// +/// Copyright (c) 2013-2015 Sensus Metering Systems +/// +using System; +using System.Windows.Forms; +using log4net; +using TBF.Resources; + +namespace TBF.BenchControl.DataEntry.WMStates +{ + public partial class WMStatesForm : Form, GenericDevices.IHasCompleted + { + private static readonly ILog log = LogManager.GetLogger(typeof(WMStatesForm)); + + /// Number of text boxes for serial numbers + public readonly int WaterMetersCount; + + // To be retrieved after the form closes + public double[] WMState; + + // Set to 'true' when the form closes + public bool Completed { get { return completed; } } + bool completed; + + /// + /// Constructor + /// + /// Number of text boxes for serial numbers + public WMStatesForm(int waterMetersCount) + { + InitializeComponent(); + ControlBox = false; + + this.WaterMetersCount = waterMetersCount; + WMState = new double[WaterMetersCount]; + + completed = false; + StartForceCloseHandler(); + } + + /// Parameterless constructor for 3 watermeters + public WMStatesForm() + : this(Config.Data.WMsCount) + { + } + + void Localize() + { + Text = Strings.Water_Meter_States; + groupBox1.Text = Strings.Water_Meter + " 1"; + groupBox2.Text = Strings.Water_Meter + " 2"; + groupBox3.Text = Strings.Water_Meter + " 3"; + groupBox4.Text = Strings.Water_Meter + " 4"; + groupBox5.Text = Strings.Water_Meter + " 5"; + groupBox6.Text = Strings.Water_Meter + " 6"; + wmStateLabel1.Text = Strings.WMState; + wmStateLabel2.Text = Strings.WMState; + wmStateLabel3.Text = Strings.WMState; + wmStateLabel4.Text = Strings.WMState; + wmStateLabel5.Text = Strings.WMState; + wmStateLabel6.Text = Strings.WMState; + okButton.Text = Strings.OkBtnText; + } + + private void CycleEndForm_Load(object sender, EventArgs e) + { + Localize(); + + Height = 195 + 90 * WaterMetersCount; + + if (WaterMetersCount < 1) groupBox1.Visible = false; + if (WaterMetersCount < 2) groupBox2.Visible = false; + if (WaterMetersCount < 3) groupBox3.Visible = false; + if (WaterMetersCount < 4) groupBox4.Visible = false; + if (WaterMetersCount < 5) groupBox5.Visible = false; + if (WaterMetersCount < 6) groupBox6.Visible = false; + } + + private void okButton_Click(object sender, EventArgs e) + { + try + { + if (WaterMetersCount >= 1) WMState[0] = Utils.ParseUDouble(wmStateTextBox1.Text); + if (WaterMetersCount >= 2) WMState[1] = Utils.ParseUDouble(wmStateTextBox2.Text); + if (WaterMetersCount >= 3) WMState[2] = Utils.ParseUDouble(wmStateTextBox3.Text); + if (WaterMetersCount >= 4) WMState[3] = Utils.ParseUDouble(wmStateTextBox4.Text); + if (WaterMetersCount >= 5) WMState[4] = Utils.ParseUDouble(wmStateTextBox5.Text); + if (WaterMetersCount >= 6) WMState[5] = Utils.ParseUDouble(wmStateTextBox6.Text); + } + catch + { + return; + } + + completed = true; + Close(); + } + + #region Forced close handling + + public void StartForceCloseHandler() + { + UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args) + { + if (InvokeRequired) { Invoke(new EventHandler(OnForceClose), sender, args); } + else OnForceClose(sender, args); + }; + } + + void OnForceClose(object sender, EventArgs args) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + #endregion + } +} diff --git a/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.designer.cs b/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.designer.cs new file mode 100644 index 000000000..dca642fdf --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.designer.cs @@ -0,0 +1,305 @@ +/// +/// Copyright (c) 2013-2015 Sensus Metering Systems +/// +namespace TBF.BenchControl.DataEntry.WMStates +{ + partial class WMStatesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox2 = new System.Windows.Forms.TextBox(); + this.wmStateLabel2 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox1 = new System.Windows.Forms.TextBox(); + this.wmStateLabel1 = new System.Windows.Forms.Label(); + this.okButton = new System.Windows.Forms.Button(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox3 = new System.Windows.Forms.TextBox(); + this.wmStateLabel3 = new System.Windows.Forms.Label(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox4 = new System.Windows.Forms.TextBox(); + this.wmStateLabel4 = new System.Windows.Forms.Label(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox5 = new System.Windows.Forms.TextBox(); + this.wmStateLabel5 = new System.Windows.Forms.Label(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.wmStateTextBox6 = new System.Windows.Forms.TextBox(); + this.wmStateLabel6 = new System.Windows.Forms.Label(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.wmStateTextBox2); + this.groupBox2.Controls.Add(this.wmStateLabel2); + this.groupBox2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox2.ForeColor = System.Drawing.Color.Black; + this.groupBox2.Location = new System.Drawing.Point(25, 102); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(362, 81); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Water Meter 2"; + // + // wmStateTextBox2 + // + this.wmStateTextBox2.Location = new System.Drawing.Point(183, 31); + this.wmStateTextBox2.Name = "wmStateTextBox2"; + this.wmStateTextBox2.Size = new System.Drawing.Size(163, 31); + this.wmStateTextBox2.TabIndex = 1; + // + // wmStateLabel2 + // + this.wmStateLabel2.AutoSize = true; + this.wmStateLabel2.Location = new System.Drawing.Point(18, 34); + this.wmStateLabel2.Name = "wmStateLabel2"; + this.wmStateLabel2.Size = new System.Drawing.Size(68, 23); + this.wmStateLabel2.TabIndex = 0; + this.wmStateLabel2.Text = "State:"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.wmStateTextBox1); + this.groupBox1.Controls.Add(this.wmStateLabel1); + this.groupBox1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox1.ForeColor = System.Drawing.Color.Black; + this.groupBox1.Location = new System.Drawing.Point(25, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(362, 81); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Water Meter 1"; + // + // wmStateTextBox1 + // + this.wmStateTextBox1.Location = new System.Drawing.Point(183, 31); + this.wmStateTextBox1.Name = "wmStateTextBox1"; + this.wmStateTextBox1.Size = new System.Drawing.Size(163, 31); + this.wmStateTextBox1.TabIndex = 1; + // + // wmStateLabel1 + // + this.wmStateLabel1.AutoSize = true; + this.wmStateLabel1.Location = new System.Drawing.Point(18, 34); + this.wmStateLabel1.Name = "wmStateLabel1"; + this.wmStateLabel1.Size = new System.Drawing.Size(68, 23); + this.wmStateLabel1.TabIndex = 0; + this.wmStateLabel1.Text = "State:"; + // + // okButton + // + this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.okButton.ForeColor = System.Drawing.Color.Black; + this.okButton.Location = new System.Drawing.Point(425, 21); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(98, 63); + this.okButton.TabIndex = 7; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.wmStateTextBox3); + this.groupBox3.Controls.Add(this.wmStateLabel3); + this.groupBox3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox3.ForeColor = System.Drawing.Color.Black; + this.groupBox3.Location = new System.Drawing.Point(25, 192); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(362, 81); + this.groupBox3.TabIndex = 3; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Water Meter 3"; + // + // wmStateTextBox3 + // + this.wmStateTextBox3.Location = new System.Drawing.Point(183, 31); + this.wmStateTextBox3.Name = "wmStateTextBox3"; + this.wmStateTextBox3.Size = new System.Drawing.Size(163, 31); + this.wmStateTextBox3.TabIndex = 1; + // + // wmStateLabel3 + // + this.wmStateLabel3.AutoSize = true; + this.wmStateLabel3.Location = new System.Drawing.Point(18, 34); + this.wmStateLabel3.Name = "wmStateLabel3"; + this.wmStateLabel3.Size = new System.Drawing.Size(68, 23); + this.wmStateLabel3.TabIndex = 0; + this.wmStateLabel3.Text = "State:"; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.wmStateTextBox4); + this.groupBox4.Controls.Add(this.wmStateLabel4); + this.groupBox4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox4.ForeColor = System.Drawing.Color.Black; + this.groupBox4.Location = new System.Drawing.Point(25, 282); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(362, 81); + this.groupBox4.TabIndex = 4; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Water Meter 4"; + // + // wmStateTextBox4 + // + this.wmStateTextBox4.Location = new System.Drawing.Point(183, 31); + this.wmStateTextBox4.Name = "wmStateTextBox4"; + this.wmStateTextBox4.Size = new System.Drawing.Size(163, 31); + this.wmStateTextBox4.TabIndex = 1; + // + // wmStateLabel4 + // + this.wmStateLabel4.AutoSize = true; + this.wmStateLabel4.Location = new System.Drawing.Point(18, 34); + this.wmStateLabel4.Name = "wmStateLabel4"; + this.wmStateLabel4.Size = new System.Drawing.Size(68, 23); + this.wmStateLabel4.TabIndex = 0; + this.wmStateLabel4.Text = "State:"; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.wmStateTextBox5); + this.groupBox5.Controls.Add(this.wmStateLabel5); + this.groupBox5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox5.ForeColor = System.Drawing.Color.Black; + this.groupBox5.Location = new System.Drawing.Point(25, 372); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(362, 81); + this.groupBox5.TabIndex = 5; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "Water Meter 5"; + // + // wmStateTextBox5 + // + this.wmStateTextBox5.Location = new System.Drawing.Point(183, 31); + this.wmStateTextBox5.Name = "wmStateTextBox5"; + this.wmStateTextBox5.Size = new System.Drawing.Size(163, 31); + this.wmStateTextBox5.TabIndex = 1; + // + // wmStateLabel5 + // + this.wmStateLabel5.AutoSize = true; + this.wmStateLabel5.Location = new System.Drawing.Point(18, 34); + this.wmStateLabel5.Name = "wmStateLabel5"; + this.wmStateLabel5.Size = new System.Drawing.Size(68, 23); + this.wmStateLabel5.TabIndex = 0; + this.wmStateLabel5.Text = "State:"; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.wmStateTextBox6); + this.groupBox6.Controls.Add(this.wmStateLabel6); + this.groupBox6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.groupBox6.ForeColor = System.Drawing.Color.Black; + this.groupBox6.Location = new System.Drawing.Point(25, 462); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(362, 81); + this.groupBox6.TabIndex = 6; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "Water Meter 6"; + // + // wmStateTextBox6 + // + this.wmStateTextBox6.Location = new System.Drawing.Point(183, 31); + this.wmStateTextBox6.Name = "wmStateTextBox6"; + this.wmStateTextBox6.Size = new System.Drawing.Size(163, 31); + this.wmStateTextBox6.TabIndex = 1; + // + // wmStateLabel6 + // + this.wmStateLabel6.AutoSize = true; + this.wmStateLabel6.Location = new System.Drawing.Point(18, 34); + this.wmStateLabel6.Name = "wmStateLabel6"; + this.wmStateLabel6.Size = new System.Drawing.Size(68, 23); + this.wmStateLabel6.TabIndex = 0; + this.wmStateLabel6.Text = "State:"; + // + // CycleEndForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.DarkGoldenrod; + this.ClientSize = new System.Drawing.Size(559, 565); + this.Controls.Add(this.groupBox6); + this.Controls.Add(this.groupBox5); + this.Controls.Add(this.groupBox4); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.okButton); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "CycleEndForm"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Water Meter States"; + this.TopMost = true; + this.Load += new System.EventHandler(this.CycleEndForm_Load); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox wmStateTextBox2; + private System.Windows.Forms.Label wmStateLabel2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox wmStateTextBox1; + private System.Windows.Forms.Label wmStateLabel1; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.TextBox wmStateTextBox3; + private System.Windows.Forms.Label wmStateLabel3; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.TextBox wmStateTextBox4; + private System.Windows.Forms.Label wmStateLabel4; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.TextBox wmStateTextBox5; + private System.Windows.Forms.Label wmStateLabel5; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.TextBox wmStateTextBox6; + private System.Windows.Forms.Label wmStateLabel6; + + } +} \ No newline at end of file diff --git a/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.resx b/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TBF/BenchControl/DataEntry/WMStates/WMStatesForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TBF/BenchControl/TbfComponents.cs b/TBF/BenchControl/TbfComponents.cs index 6972707ef..810b0eb8c 100644 --- a/TBF/BenchControl/TbfComponents.cs +++ b/TBF/BenchControl/TbfComponents.cs @@ -42,6 +42,7 @@ namespace TBF.BenchControl Factories.Add(new DataEntry.Standard48.Factory()); Factories.Add(new DataEntry.Standard48.FactoryNoStartEnd()); Factories.Add(new DataEntry.StandardCamera.Factory()); + Factories.Add(new DataEntry.WMStates.EntryFormFactory()); Factories.Add(new RegisterReaders.KPackE.DataEntryForRadio.Factory()); /// DataEntry for KPackE radio Factories.Add(new Dummy.Balance.Factory()); Factories.Add(new Dummy.Diverter.Factory()); diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index a5c41425c..9729f15c5 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -494,6 +494,27 @@ TestStartEndForm.cs + + + + UserControl + + + EntryFormCfgCtrl.cs + + + + Form + + + WMSNsAndStatesForm.cs + + + Form + + + WMStatesForm.cs + @@ -2792,6 +2813,15 @@ TestStartEndForm.cs + + EntryFormCfgCtrl.cs + + + WMSNsAndStatesForm.cs + + + WMStatesForm.cs + FlowMeterCfgCtrl.cs