Flow selection test wizard uses a Tab-control, bug in ProcedureDlg (causing a non-zero initial Qfrom/Qto) fixed.

This commit is contained in:
Milan Hanajik 2017-10-17 18:24:03 +02:00
parent 9a905c6111
commit 8d669d9f54
3 changed files with 294 additions and 165 deletions

View File

@ -1742,9 +1742,6 @@ namespace TBF
TestWizard.Roi1 roi1Dlg = new TestWizard.Roi1(false, false, roiData);
TestWizard.Roi2 roi2Dlg = new TestWizard.Roi2(false, false, roiData);
TestWizard.Roi3 roi3Dlg = new TestWizard.Roi3(false, false, roiData);
roiData.Calculate();
test.Qfrom = (float)(roiData.Q * 0.95);
test.Qto = (float)(roiData.Q * 1.05);
//test.
methodLabel:
@ -1790,6 +1787,11 @@ namespace TBF
case DialogResult.Retry: goto roi_detection_label_2;
}
/// Pre-calculate additional data and flow for ROI detection
roiData.Calculate();
test.Qfrom = (float)(roiData.Q * 0.95);
test.Qto = (float)(roiData.Q * 1.05);
flowLabel:
switch (flowDlg.ShowDialog())
{

View File

@ -32,22 +32,35 @@ namespace TBF.TestWizard
private void InitializeComponent()
{
this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.qFromLabel = new System.Windows.Forms.Label();
this.qToLabel = new System.Windows.Forms.Label();
this.qFromTextBox = new System.Windows.Forms.TextBox();
this.qToTextBox = new System.Windows.Forms.TextBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.q2TextBox = new System.Windows.Forms.TextBox();
this.dQTextBox = new System.Windows.Forms.TextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.q3TextBox = new System.Windows.Forms.TextBox();
this.dQpctTextBox = new System.Windows.Forms.TextBox();
this.sensorsComboBox = new System.Windows.Forms.ComboBox();
this.sensorsLabel = new System.Windows.Forms.Label();
this.qToTextBox = new System.Windows.Forms.TextBox();
this.qFromTextBox = new System.Windows.Forms.TextBox();
this.qToLabel = new System.Windows.Forms.Label();
this.qFromLabel = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.nextButton = new System.Windows.Forms.Button();
this.backButton = new System.Windows.Forms.Button();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton3 = new System.Windows.Forms.RadioButton();
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit();
this.horizSplitContainer.Panel1.SuspendLayout();
this.horizSplitContainer.Panel2.SuspendLayout();
this.horizSplitContainer.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.SuspendLayout();
//
// horizSplitContainer
@ -60,15 +73,9 @@ namespace TBF.TestWizard
//
// horizSplitContainer.Panel1
//
this.horizSplitContainer.Panel1.Controls.Add(this.radioButton3);
this.horizSplitContainer.Panel1.Controls.Add(this.radioButton2);
this.horizSplitContainer.Panel1.Controls.Add(this.radioButton1);
this.horizSplitContainer.Panel1.Controls.Add(this.tabControl1);
this.horizSplitContainer.Panel1.Controls.Add(this.sensorsComboBox);
this.horizSplitContainer.Panel1.Controls.Add(this.sensorsLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.qToTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.qFromTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.qToLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.qFromLabel);
//
// horizSplitContainer.Panel2
//
@ -79,6 +86,161 @@ namespace TBF.TestWizard
this.horizSplitContainer.SplitterDistance = 182;
this.horizSplitContainer.TabIndex = 1;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Location = new System.Drawing.Point(0, 3);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(284, 123);
this.tabControl1.TabIndex = 11;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.SystemColors.Control;
this.tabPage1.Controls.Add(this.qFromLabel);
this.tabPage1.Controls.Add(this.qToLabel);
this.tabPage1.Controls.Add(this.qFromTextBox);
this.tabPage1.Controls.Add(this.qToTextBox);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(276, 97);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Q from / Q to";
//
// qFromLabel
//
this.qFromLabel.AutoSize = true;
this.qFromLabel.Location = new System.Drawing.Point(18, 35);
this.qFromLabel.Name = "qFromLabel";
this.qFromLabel.Size = new System.Drawing.Size(72, 13);
this.qFromLabel.TabIndex = 1;
this.qFromLabel.Text = "Q from [m3/h]";
//
// qToLabel
//
this.qToLabel.AutoSize = true;
this.qToLabel.Location = new System.Drawing.Point(18, 61);
this.qToLabel.Name = "qToLabel";
this.qToLabel.Size = new System.Drawing.Size(61, 13);
this.qToLabel.TabIndex = 2;
this.qToLabel.Text = "Q to [m3/h]";
//
// qFromTextBox
//
this.qFromTextBox.Location = new System.Drawing.Point(134, 32);
this.qFromTextBox.Name = "qFromTextBox";
this.qFromTextBox.Size = new System.Drawing.Size(124, 20);
this.qFromTextBox.TabIndex = 4;
this.qFromTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// qToTextBox
//
this.qToTextBox.Location = new System.Drawing.Point(134, 58);
this.qToTextBox.Name = "qToTextBox";
this.qToTextBox.Size = new System.Drawing.Size(124, 20);
this.qToTextBox.TabIndex = 5;
this.qToTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// tabPage2
//
this.tabPage2.BackColor = System.Drawing.SystemColors.Control;
this.tabPage2.Controls.Add(this.label1);
this.tabPage2.Controls.Add(this.label2);
this.tabPage2.Controls.Add(this.q2TextBox);
this.tabPage2.Controls.Add(this.dQTextBox);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(276, 97);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Q +/- dQ";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(18, 35);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(49, 13);
this.label1.TabIndex = 6;
this.label1.Text = "Q [m3/h]";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(18, 61);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(55, 13);
this.label2.TabIndex = 7;
this.label2.Text = "dQ [m3/h]";
//
// q2TextBox
//
this.q2TextBox.Location = new System.Drawing.Point(134, 32);
this.q2TextBox.Name = "q2TextBox";
this.q2TextBox.Size = new System.Drawing.Size(124, 20);
this.q2TextBox.TabIndex = 8;
this.q2TextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// dQTextBox
//
this.dQTextBox.Location = new System.Drawing.Point(134, 58);
this.dQTextBox.Name = "dQTextBox";
this.dQTextBox.Size = new System.Drawing.Size(124, 20);
this.dQTextBox.TabIndex = 9;
this.dQTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// tabPage3
//
this.tabPage3.BackColor = System.Drawing.SystemColors.Control;
this.tabPage3.Controls.Add(this.label3);
this.tabPage3.Controls.Add(this.label4);
this.tabPage3.Controls.Add(this.q3TextBox);
this.tabPage3.Controls.Add(this.dQpctTextBox);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(276, 97);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Q +/- delta [%]";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(18, 35);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(49, 13);
this.label3.TabIndex = 6;
this.label3.Text = "Q [m3/h]";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(18, 61);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(38, 13);
this.label4.TabIndex = 7;
this.label4.Text = "dQ [%]";
//
// q3TextBox
//
this.q3TextBox.Location = new System.Drawing.Point(134, 32);
this.q3TextBox.Name = "q3TextBox";
this.q3TextBox.Size = new System.Drawing.Size(124, 20);
this.q3TextBox.TabIndex = 8;
this.q3TextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// dQpctTextBox
//
this.dQpctTextBox.Location = new System.Drawing.Point(134, 58);
this.dQpctTextBox.Name = "dQpctTextBox";
this.dQpctTextBox.Size = new System.Drawing.Size(124, 20);
this.dQpctTextBox.TabIndex = 9;
this.dQpctTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// sensorsComboBox
//
this.sensorsComboBox.FormattingEnabled = true;
@ -97,40 +259,6 @@ namespace TBF.TestWizard
this.sensorsLabel.TabIndex = 6;
this.sensorsLabel.Text = "Sensors";
//
// qToTextBox
//
this.qToTextBox.Location = new System.Drawing.Point(137, 119);
this.qToTextBox.Name = "qToTextBox";
this.qToTextBox.Size = new System.Drawing.Size(124, 20);
this.qToTextBox.TabIndex = 5;
this.qToTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// qFromTextBox
//
this.qFromTextBox.Location = new System.Drawing.Point(137, 93);
this.qFromTextBox.Name = "qFromTextBox";
this.qFromTextBox.Size = new System.Drawing.Size(124, 20);
this.qFromTextBox.TabIndex = 4;
this.qFromTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// qToLabel
//
this.qToLabel.AutoSize = true;
this.qToLabel.Location = new System.Drawing.Point(21, 122);
this.qToLabel.Name = "qToLabel";
this.qToLabel.Size = new System.Drawing.Size(61, 13);
this.qToLabel.TabIndex = 2;
this.qToLabel.Text = "Q to [m3/h]";
//
// qFromLabel
//
this.qFromLabel.AutoSize = true;
this.qFromLabel.Location = new System.Drawing.Point(21, 96);
this.qFromLabel.Name = "qFromLabel";
this.qFromLabel.Size = new System.Drawing.Size(72, 13);
this.qFromLabel.TabIndex = 1;
this.qFromLabel.Text = "Q from [m3/h]";
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@ -166,42 +294,6 @@ namespace TBF.TestWizard
this.backButton.UseVisualStyleBackColor = true;
this.backButton.Click += new System.EventHandler(this.backButton_Click);
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(24, 19);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(85, 17);
this.radioButton1.TabIndex = 8;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Q from - Q to";
this.radioButton1.UseVisualStyleBackColor = true;
this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(24, 40);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(67, 17);
this.radioButton2.TabIndex = 9;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "Q +/- dQ";
this.radioButton2.UseVisualStyleBackColor = true;
this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// radioButton3
//
this.radioButton3.AutoSize = true;
this.radioButton3.Location = new System.Drawing.Point(24, 61);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(61, 17);
this.radioButton3.TabIndex = 10;
this.radioButton3.TabStop = true;
this.radioButton3.Text = "Q +/- %";
this.radioButton3.UseVisualStyleBackColor = true;
this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
//
// FlowSelection
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -217,6 +309,13 @@ namespace TBF.TestWizard
this.horizSplitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit();
this.horizSplitContainer.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.ResumeLayout(false);
}
@ -232,10 +331,19 @@ namespace TBF.TestWizard
private System.Windows.Forms.Label qToLabel;
private System.Windows.Forms.Label qFromLabel;
private System.Windows.Forms.ComboBox sensorsComboBox;
private System.Windows.Forms.Label sensorsLabel;
private System.Windows.Forms.RadioButton radioButton3;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.Label sensorsLabel;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox q2TextBox;
private System.Windows.Forms.TextBox dQTextBox;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox q3TextBox;
private System.Windows.Forms.TextBox dQpctTextBox;
}
}

View File

@ -1,13 +1,8 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Config.Entities;
using TBF.Resources;
@ -31,9 +26,6 @@ namespace TBF.TestWizard
{
InitializeComponent();
radioButton1.Checked = true;
radioButton2.Checked = false;
radioButton3.Checked = false;
qSpec = QSpec.Qfrom_Qto;
Text = Strings.Flow_selection;
@ -75,22 +67,27 @@ namespace TBF.TestWizard
void UpdateTest()
{
double Q1 = Utils.ParseUDouble(qFromTextBox.Text);
double Q2 = Utils.ParseUDouble(qToTextBox.Text);
double Q, dQ;
switch (qSpec)
{
default:
case QSpec.Qfrom_Qto:
test.Qfrom = (float)Q1;
test.Qto = (float)Q2;
test.Qfrom = (float)Utils.ParseUDouble(qFromTextBox.Text);
test.Qto = (float)Utils.ParseUDouble(qToTextBox.Text);
break;
case QSpec.Q_dQ:
test.Qfrom = (float)(Q1 - Q2);
test.Qto = (float)(Q1 + Q2);
Q = Utils.ParseUDouble(q2TextBox.Text);
dQ = Utils.ParseUDouble(dQTextBox.Text);
test.Qfrom = (float)(Q - dQ);
test.Qto = (float)(Q + dQ);
break;
case QSpec.Q_dPct:
test.Qfrom = (float)(Q1 * (1 - Q2 / 100.0f));
test.Qto = (float)(Q1 * (1 + Q2 / 100.0f));
Q = Utils.ParseUDouble(q3TextBox.Text);
dQ = Utils.ParseUDouble(dQpctTextBox.Text);
test.Qfrom = (float)(Q * (1 - dQ / 100.0f));
test.Qto = (float)(Q * (1 + dQ / 100.0f));
break;
}
@ -103,9 +100,24 @@ namespace TBF.TestWizard
bool IsFormValid()
{
float dummy;
return Utils.TryParseUFloat(qFromTextBox.Text, out dummy) &&
Utils.TryParseUFloat(qToTextBox.Text, out dummy) &&
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
switch (qSpec)
{
default:
case QSpec.Qfrom_Qto:
return Utils.TryParseUFloat(qFromTextBox.Text, out dummy) &&
Utils.TryParseUFloat(qToTextBox.Text, out dummy) &&
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
case QSpec.Q_dQ:
return Utils.TryParseUFloat(q2TextBox.Text, out dummy) &&
Utils.TryParseUFloat(dQTextBox.Text, out dummy) &&
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
case QSpec.Q_dPct:
return Utils.TryParseUFloat(q3TextBox.Text, out dummy) &&
Utils.TryParseUFloat(dQpctTextBox.Text, out dummy) &&
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
}
}
private void backButton_Click(object sender, EventArgs e)
@ -139,66 +151,73 @@ namespace TBF.TestWizard
nextButton.Enabled = IsFormValid();
}
private void radioButton1_CheckedChanged(object sender, EventArgs e) { if (radioButton1.Checked) ReadRadioButtons(); }
private void radioButton2_CheckedChanged(object sender, EventArgs e) { if (radioButton2.Checked) ReadRadioButtons(); }
private void radioButton3_CheckedChanged(object sender, EventArgs e) { if (radioButton3.Checked) ReadRadioButtons(); }
void ReadRadioButtons()
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
double Q1 = 0;
double Q2 = 0;
bool floatDataOk = Utils.TryParseUDouble(qFromTextBox.Text, out Q1)
&& Utils.TryParseUDouble(qToTextBox.Text, out Q2);
double Q1,Q2;
if (radioButton1.Checked)
switch ((QSpec)tabControl1.SelectedIndex)
{
if (floatDataOk && qSpec == QSpec.Q_dQ)
{
qFromTextBox.Text = (Q1 - Q2).ToString();
qToTextBox.Text = (Q1 + Q2).ToString();
}
else if (floatDataOk && qSpec == QSpec.Q_dPct)
{
qFromTextBox.Text = (Q1 * (1 - Q2 / 100.0)).ToString();
qToTextBox.Text = (Q1 * (1 + Q2 / 100.0)).ToString();
}
default:
case QSpec.Qfrom_Qto:
if (qSpec == QSpec.Q_dQ &&
Utils.TryParseUDouble(q2TextBox.Text, out Q1) &&
Utils.TryParseUDouble(dQTextBox.Text, out Q2))
{
qFromTextBox.Text = (Q1 - Q2).ToString();
qToTextBox.Text = (Q1 + Q2).ToString();
}
else if (qSpec == QSpec.Q_dPct &&
Utils.TryParseUDouble(q3TextBox.Text, out Q1) &&
Utils.TryParseUDouble(dQpctTextBox.Text, out Q2))
{
qFromTextBox.Text = (Q1 * (1 - Q2 / 100.0)).ToString();
qToTextBox.Text = (Q1 * (1 + Q2 / 100.0)).ToString();
}
qSpec = QSpec.Qfrom_Qto;
qFromLabel.Text = Strings.Q_from_m3h;
qToLabel.Text = Strings.Q_to_m3h;
}
else if (radioButton2.Checked)
{
if (floatDataOk && qSpec == QSpec.Qfrom_Qto)
{
qFromTextBox.Text = ((Q1 + Q2) / 2.0).ToString();
qToTextBox.Text = ((Q2 - Q1) / 2.0).ToString();
}
else if (floatDataOk && qSpec == QSpec.Q_dPct)
{
qToTextBox.Text = (Q1 * Q2 / 100.0).ToString();
}
qSpec = QSpec.Qfrom_Qto;
break;
qSpec = QSpec.Q_dQ;
qFromLabel.Text = "Q [m3/h]";
qToLabel.Text = "dQ [m3/h]";
}
else if (radioButton3.Checked)
{
if (floatDataOk && qSpec == QSpec.Qfrom_Qto)
{
qFromTextBox.Text = ((Q1 + Q2) / 2.0).ToString();
qToTextBox.Text = (100.0 * (Q2 - Q1) / (Q1 + Q2)).ToString();
}
else if (floatDataOk && qSpec == QSpec.Q_dQ)
{
qToTextBox.Text = (100.0 * Q2 / Q1).ToString();
}
case QSpec.Q_dQ:
if (qSpec == QSpec.Qfrom_Qto &&
Utils.TryParseUDouble(qFromTextBox.Text, out Q1) &&
Utils.TryParseUDouble(qToTextBox.Text, out Q2))
{
q2TextBox.Text = ((Q1 + Q2) / 2.0).ToString();
dQTextBox.Text = ((Q2 - Q1) / 2.0).ToString();
}
else if (qSpec == QSpec.Q_dPct &&
Utils.TryParseUDouble(q3TextBox.Text, out Q1) &&
Utils.TryParseUDouble(dQpctTextBox.Text, out Q2))
{
q2TextBox.Text = q3TextBox.Text;
dQTextBox.Text = (Q1 * Q2 / 100.0).ToString();
}
qSpec = QSpec.Q_dPct;
qFromLabel.Text = "Q [m3/h]";
qToLabel.Text = "dQ [%]";
qSpec = QSpec.Q_dQ;
break;
case QSpec.Q_dPct:
if (qSpec == QSpec.Qfrom_Qto &&
Utils.TryParseUDouble(qFromTextBox.Text, out Q1) &&
Utils.TryParseUDouble(qToTextBox.Text, out Q2))
{
q3TextBox.Text = ((Q1 + Q2) / 2.0).ToString();
dQpctTextBox.Text = (Q1 + Q2 != 0) ? (100.0 * (Q2 - Q1) / (Q1 + Q2)).ToString() : string.Empty;
}
else if (qSpec == QSpec.Q_dQ &&
Utils.TryParseUDouble(q2TextBox.Text, out Q1) &&
Utils.TryParseUDouble(dQTextBox.Text, out Q2) &&
Q1 != 0)
{
q3TextBox.Text = q2TextBox.Text;
dQpctTextBox.Text = (Q1 != 0) ? (100.0 * Q2 / Q1).ToString() : string.Empty;
}
qSpec = QSpec.Q_dPct;
break;
}
nextButton.Enabled = IsFormValid();
}
}
}