From 4d616939ad03da3ee60ba8584c86ffb183a1364e Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Thu, 4 Aug 2016 16:22:41 +0200 Subject: [PATCH] TestWizard.HeatMetersSelection added. --- TestBenchFramework/ProcedureDlg.cs | 12 ++ .../Resources/Strings.Designer.cs | 9 ++ TestBenchFramework/Resources/Strings.resx | 3 + TestBenchFramework/TBF.csproj | 9 ++ .../HeatMetersSelection.Designer.cs | 116 +++++++++++++++++ .../TestWizard/HeatMetersSelection.cs | 92 ++++++++++++++ .../TestWizard/HeatMetersSelection.resx | 120 ++++++++++++++++++ 7 files changed, 361 insertions(+) create mode 100644 TestBenchFramework/TestWizard/HeatMetersSelection.Designer.cs create mode 100644 TestBenchFramework/TestWizard/HeatMetersSelection.cs create mode 100644 TestBenchFramework/TestWizard/HeatMetersSelection.resx diff --git a/TestBenchFramework/ProcedureDlg.cs b/TestBenchFramework/ProcedureDlg.cs index 8631a7f12..b31c01ce0 100644 --- a/TestBenchFramework/ProcedureDlg.cs +++ b/TestBenchFramework/ProcedureDlg.cs @@ -1507,6 +1507,7 @@ namespace TBF TestWizard.FlowSelection flowDlg = new TestWizard.FlowSelection(false, false, test, metersPaths); TestWizard.VolumeAndErrorSelection volumeDlg = new TestWizard.VolumeAndErrorSelection(false, true, test); TestWizard.PressureSelection pressureDlg = new TestWizard.PressureSelection(false, true, test); + TestWizard.HeatMetersSelection heatMetersDlg = new TestWizard.HeatMetersSelection(false, false, test); //TestWizard.SensorsSelection sensorsDlg = new TestWizard.SensorsSelection(test); methodLabel: @@ -1519,6 +1520,7 @@ namespace TBF if (selectedMethod is BenchControl.TestMethods.PMaxTest.TestMethod) goto pressure_label; if (selectedMethod is BenchControl.TestMethods.LeakTest.TestMethod) goto pressure_label; + if (selectedMethod is BenchControl.TestMethods.HeatMeters.TestMethod) goto heat_meters_label; flowLabel: switch (flowDlg.ShowDialog()) @@ -1561,7 +1563,17 @@ namespace TBF } goto done; + + heat_meters_label: + DialogResult dr = heatMetersDlg.ShowDialog(); + switch (dr) + { + case DialogResult.Cancel: return; + case DialogResult.Retry: goto methodLabel; + } + goto flowLabel; + pressure_label: switch (pressureDlg.ShowDialog()) diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs index d72397940..f93e0035d 100644 --- a/TestBenchFramework/Resources/Strings.Designer.cs +++ b/TestBenchFramework/Resources/Strings.Designer.cs @@ -1446,6 +1446,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Heat meter options. + /// + internal static string Heat_meter_options { + get { + return ResourceManager.GetString("Heat_meter_options", resourceCulture); + } + } + /// /// Looks up a localized string similar to Heat meter sensors. /// diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx index e646f170c..f2c6b1409 100644 --- a/TestBenchFramework/Resources/Strings.resx +++ b/TestBenchFramework/Resources/Strings.resx @@ -1531,4 +1531,7 @@ T warm to + + Heat meter options + \ No newline at end of file diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 554a37477..b270cd7e3 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -1334,6 +1334,12 @@ FlowSelection.cs + + Form + + + HeatMetersSelection.cs + Form @@ -1928,6 +1934,9 @@ FlowSelection.cs + + HeatMetersSelection.cs + MethodSelection.cs diff --git a/TestBenchFramework/TestWizard/HeatMetersSelection.Designer.cs b/TestBenchFramework/TestWizard/HeatMetersSelection.Designer.cs new file mode 100644 index 000000000..450b3b545 --- /dev/null +++ b/TestBenchFramework/TestWizard/HeatMetersSelection.Designer.cs @@ -0,0 +1,116 @@ +namespace TBF.TestWizard +{ + partial class HeatMetersSelection + { + /// + /// 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.horizSplitContainer = new System.Windows.Forms.SplitContainer(); + this.cancelButton = new System.Windows.Forms.Button(); + this.nextButton = new System.Windows.Forms.Button(); + this.backButton = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit(); + this.horizSplitContainer.Panel2.SuspendLayout(); + this.horizSplitContainer.SuspendLayout(); + this.SuspendLayout(); + // + // horizSplitContainer + // + this.horizSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill; + this.horizSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.horizSplitContainer.Location = new System.Drawing.Point(0, 0); + this.horizSplitContainer.Name = "horizSplitContainer"; + this.horizSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // horizSplitContainer.Panel2 + // + this.horizSplitContainer.Panel2.Controls.Add(this.cancelButton); + this.horizSplitContainer.Panel2.Controls.Add(this.nextButton); + this.horizSplitContainer.Panel2.Controls.Add(this.backButton); + this.horizSplitContainer.Size = new System.Drawing.Size(284, 262); + this.horizSplitContainer.SplitterDistance = 182; + this.horizSplitContainer.TabIndex = 2; + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(186, 17); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 42); + this.cancelButton.TabIndex = 27; + this.cancelButton.Text = "&Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); + // + // nextButton + // + this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.nextButton.Location = new System.Drawing.Point(105, 17); + this.nextButton.Name = "nextButton"; + this.nextButton.Size = new System.Drawing.Size(75, 42); + this.nextButton.TabIndex = 26; + this.nextButton.Text = "&Next >"; + this.nextButton.UseVisualStyleBackColor = true; + this.nextButton.Click += new System.EventHandler(this.nextButton_Click); + // + // backButton + // + this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.backButton.DialogResult = System.Windows.Forms.DialogResult.Retry; + this.backButton.Location = new System.Drawing.Point(24, 17); + this.backButton.Name = "backButton"; + this.backButton.Size = new System.Drawing.Size(75, 42); + this.backButton.TabIndex = 25; + this.backButton.Text = "< &Back"; + this.backButton.UseVisualStyleBackColor = true; + this.backButton.Click += new System.EventHandler(this.backButton_Click); + // + // HeatMetersSelection + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 262); + this.Controls.Add(this.horizSplitContainer); + this.Name = "HeatMetersSelection"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "HeatMetersSelection"; + this.Load += new System.EventHandler(this.HeatMetersSelection_Load); + this.horizSplitContainer.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit(); + this.horizSplitContainer.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.SplitContainer horizSplitContainer; + private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.Button nextButton; + private System.Windows.Forms.Button backButton; + } +} \ No newline at end of file diff --git a/TestBenchFramework/TestWizard/HeatMetersSelection.cs b/TestBenchFramework/TestWizard/HeatMetersSelection.cs new file mode 100644 index 000000000..1d42bec68 --- /dev/null +++ b/TestBenchFramework/TestWizard/HeatMetersSelection.cs @@ -0,0 +1,92 @@ +using System; +using System.Windows.Forms; +using Config.Entities; +using TBF.Resources; + +namespace TBF.TestWizard +{ + public partial class HeatMetersSelection : Form + { + Test test; + + public HeatMetersSelection() + { + InitializeComponent(); + } + + public HeatMetersSelection(bool first, bool last, Test test) + : this() + { + this.test = test; + + Text = Strings.Heat_meter_options; + backButton.Text = Strings.BackBtnText; + nextButton.Text = Strings.NextBtnText; + cancelButton.Text = Strings.CancelBtnText; + + if (first) backButton.Visible = false; + if (last) nextButton.Text = Strings.FinishBtnText; + } + + private void HeatMetersSelection_Load(object sender, EventArgs e) + { + if (test == null) return; + + RefreshWizardPage(); + } + + void RefreshWizardPage() + { + /// someTextBox.Text = test.SomeParam.ToString(); + + nextButton.Enabled = IsFormValid(); + } + + void UpdateTest() + { + /// TODO: complete + //test.Qfrom = Utils.ParseUFloat(pressureLoTextBox.Text); + //test.Qto = Utils.ParseUFloat(pressureHiTextBox.Text); + //test.TstTime = int.Parse(durationTextBox.Text); + } + + bool IsFormValid() + { + /// int dummy; + /// return int.TryParse(someTextBox.Text, out dummy); + + return true; + } + + private void backButton_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Retry; + Close(); + } + + private void nextButton_Click(object sender, EventArgs e) + { + if (test != null && IsFormValid()) + { + UpdateTest(); + DialogResult = DialogResult.OK; + Close(); + } + else + { + DialogResult = DialogResult.None; + } + } + + private void cancelButton_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + private void anyTextBox_TextChanged(object sender, EventArgs e) + { + nextButton.Enabled = IsFormValid(); + } + } +} diff --git a/TestBenchFramework/TestWizard/HeatMetersSelection.resx b/TestBenchFramework/TestWizard/HeatMetersSelection.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/TestWizard/HeatMetersSelection.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