diff --git a/MiniPrf/Ui/FrmMainMiniPrf.Designer.cs b/MiniPrf/Ui/FrmMainMiniPrf.Designer.cs index 956d9570..c92470c6 100644 --- a/MiniPrf/Ui/FrmMainMiniPrf.Designer.cs +++ b/MiniPrf/Ui/FrmMainMiniPrf.Designer.cs @@ -59,7 +59,6 @@ this.lblTimeText = new System.Windows.Forms.Label(); this.lblWaitingForMeterResponse = new System.Windows.Forms.Label(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.lblFwUpdateInfo = new System.Windows.Forms.Label(); this.barSingleProgressUpdate = new System.Windows.Forms.ProgressBar(); this.lblActualProcess = new System.Windows.Forms.Label(); this.btnDutToRefRegulation = new System.Windows.Forms.Button(); @@ -67,7 +66,7 @@ this.lblPulseVolumeCmRelation = new System.Windows.Forms.Label(); this.tbxRefCalibrationResultPulsePerCm = new System.Windows.Forms.TextBox(); this.lblWeightScaleVolume = new System.Windows.Forms.Label(); - this.tbxWeightScaleMass_liters = new System.Windows.Forms.TextBox(); + this.tbxWeightScaleVolumeLiters = new System.Windows.Forms.TextBox(); this.lblMeasuredRefPulses = new System.Windows.Forms.Label(); this.tbxMeasuredRefPulses = new System.Windows.Forms.TextBox(); this.btnManualRefCalibration = new System.Windows.Forms.Button(); @@ -402,16 +401,6 @@ this.pictureBox1.TabIndex = 78; this.pictureBox1.TabStop = false; // - // lblFwUpdateInfo - // - this.lblFwUpdateInfo.AutoSize = true; - this.lblFwUpdateInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblFwUpdateInfo.Location = new System.Drawing.Point(301, 21); - this.lblFwUpdateInfo.Name = "lblFwUpdateInfo"; - this.lblFwUpdateInfo.Size = new System.Drawing.Size(72, 13); - this.lblFwUpdateInfo.TabIndex = 77; - this.lblFwUpdateInfo.Text = "Version: 0.0.0"; - // // barSingleProgressUpdate // this.barSingleProgressUpdate.Location = new System.Drawing.Point(7, 409); @@ -444,7 +433,7 @@ this.gbxManualRefCalibration.Controls.Add(this.lblPulseVolumeCmRelation); this.gbxManualRefCalibration.Controls.Add(this.tbxRefCalibrationResultPulsePerCm); this.gbxManualRefCalibration.Controls.Add(this.lblWeightScaleVolume); - this.gbxManualRefCalibration.Controls.Add(this.tbxWeightScaleMass_liters); + this.gbxManualRefCalibration.Controls.Add(this.tbxWeightScaleVolumeLiters); this.gbxManualRefCalibration.Controls.Add(this.lblMeasuredRefPulses); this.gbxManualRefCalibration.Controls.Add(this.tbxMeasuredRefPulses); this.gbxManualRefCalibration.Controls.Add(this.btnManualRefCalibration); @@ -482,15 +471,15 @@ this.lblWeightScaleVolume.TabIndex = 70; this.lblWeightScaleVolume.Text = "Weight Scale [liters]:"; // - // tbxWeightScaleMass_liters + // tbxWeightScaleVolumeLiters // - this.tbxWeightScaleMass_liters.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.tbxWeightScaleMass_liters.Location = new System.Drawing.Point(140, 50); - this.tbxWeightScaleMass_liters.Name = "tbxWeightScaleMass_liters"; - this.tbxWeightScaleMass_liters.Size = new System.Drawing.Size(120, 20); - this.tbxWeightScaleMass_liters.TabIndex = 71; - this.tbxWeightScaleMass_liters.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxWeightScaleMass_KeyStoke); - this.tbxWeightScaleMass_liters.Leave += new System.EventHandler(this.tbxWeightScaleMass_Leave); + this.tbxWeightScaleVolumeLiters.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.tbxWeightScaleVolumeLiters.Location = new System.Drawing.Point(140, 50); + this.tbxWeightScaleVolumeLiters.Name = "tbxWeightScaleVolumeLiters"; + this.tbxWeightScaleVolumeLiters.Size = new System.Drawing.Size(120, 20); + this.tbxWeightScaleVolumeLiters.TabIndex = 71; + this.tbxWeightScaleVolumeLiters.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxWeightScaleMass_KeyStoke); + this.tbxWeightScaleVolumeLiters.Leave += new System.EventHandler(this.tbxWeightScaleMass_Leave); // // lblMeasuredRefPulses // @@ -596,7 +585,6 @@ this.Controls.Add(this.lblTimeText); this.Controls.Add(this.lblWaitingForMeterResponse); this.Controls.Add(this.pictureBox1); - this.Controls.Add(this.lblFwUpdateInfo); this.Controls.Add(this.barSingleProgressUpdate); this.Controls.Add(this.lblActualProcess); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -643,7 +631,6 @@ private System.Windows.Forms.Label lblTimeText; private System.Windows.Forms.Label lblWaitingForMeterResponse; private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.Label lblFwUpdateInfo; private System.Windows.Forms.ProgressBar barSingleProgressUpdate; private System.Windows.Forms.Label lblActualProcess; private System.Windows.Forms.ComboBox cbxFM2014TolerancePercent; @@ -660,7 +647,7 @@ private System.Windows.Forms.Label lblPulseVolumeCmRelation; private System.Windows.Forms.TextBox tbxRefCalibrationResultPulsePerCm; private System.Windows.Forms.Label lblWeightScaleVolume; - private System.Windows.Forms.TextBox tbxWeightScaleMass_liters; + private System.Windows.Forms.TextBox tbxWeightScaleVolumeLiters; private System.Windows.Forms.Label lblActualMeasuredTolerance; private System.Windows.Forms.TextBox tbxActualMeasuredToleranceDutToRef; private System.Windows.Forms.Label lblActualFlowRateCmPerHour; diff --git a/MiniPrf/Ui/FrmMainMiniPrf.cs b/MiniPrf/Ui/FrmMainMiniPrf.cs index 286cc257..5c370111 100644 --- a/MiniPrf/Ui/FrmMainMiniPrf.cs +++ b/MiniPrf/Ui/FrmMainMiniPrf.cs @@ -203,7 +203,7 @@ namespace Sensus.MiniPrf.Ui lblMeasuredRefPulses.Text = Resources.StrLblMeasuredRefPulses; tbxMeasuredRefPulses.Text = ""; lblWeightScaleVolume.Text = Resources.StrLblMeasuredWeightScaleVolume; - tbxWeightScaleMass_liters.Text = ""; + tbxWeightScaleVolumeLiters.Text = ""; lblPulseVolumeCmRelation.Text = Resources.StrLblRefPulsesPerCm; tbxRefCalibrationResultPulsePerCm.Text = ""; btnManualRefCalibration.Text = Resources.StrBtnStartCalibration; @@ -266,8 +266,6 @@ namespace Sensus.MiniPrf.Ui private void FrmMainMiniPrf_Load(Object sender, EventArgs e) { - var version = Assembly.GetExecutingAssembly().GetName().Version; - lblFwUpdateInfo.Text = $@"Version: {version.Major}.{version.Minor}.{version.Build}"; Init(); var xPosition = Location.X + Size.Width; @@ -278,9 +276,10 @@ namespace Sensus.MiniPrf.Ui _frmHistory.Show(); } - LogText($"MiniPrf: {_version.Major}.{_version.Minor}.{_version.Build}"); + var version = $"Version: {_version.Major}.{_version.Minor}.{_version.Build}"; + Text = $@"MiniPrf - {version}"; + LogText($"MiniPrf: {version}"); LogText(StrSeparator); - } private void FrmMainMiniPrf_FormClosed(Object sender, FormClosedEventArgs e) @@ -326,7 +325,7 @@ namespace Sensus.MiniPrf.Ui btnFM2014Connect.Enabled = false; // Disable manual input - tbxWeightScaleMass_liters.ReadOnly = true; + tbxWeightScaleVolumeLiters.ReadOnly = true; tbxRefPulsePerCm.ReadOnly = true; tbxDutPulsePerCm.ReadOnly = true; @@ -353,7 +352,7 @@ namespace Sensus.MiniPrf.Ui btnDutToRefRegulation.Text = Resources.StrBtnStartRegulation; // Enable manual input - tbxWeightScaleMass_liters.ReadOnly = false; + tbxWeightScaleVolumeLiters.ReadOnly = false; tbxRefPulsePerCm.ReadOnly = false; tbxDutPulsePerCm.ReadOnly = false; @@ -756,6 +755,10 @@ namespace Sensus.MiniPrf.Ui tbxRefPulsePerVolume_Leave(this, null); } } + + private String _backupWeightScaleVolumeLitersStr; + private String _backupRefCalibrationResultPulsePerCmStr; + private String _backupMeasuredRefPulsesStr; /// /// After manual input of the REF pulses per cubic meter the scale REF to DUT has to be recalculated /// @@ -769,6 +772,25 @@ namespace Sensus.MiniPrf.Ui { Fm2014.Ref_pulse_per_cm = (UInt16)pulses_per_cm; tbxScaleRefToDut.Text = $@"{Fm2014.RefToDutScale_norm:F3}"; + // If the REF pulses per cubic meter have been changed manually, the 'Manual REF Calibration' + // fields have to be cleared if those are different. A backup to restore it may be useful. + if (!tbxRefPulsePerCm.Text.Equals(tbxRefCalibrationResultPulsePerCm.Text) && + !string.IsNullOrEmpty(tbxRefCalibrationResultPulsePerCm.Text)) + { + _backupMeasuredRefPulsesStr = tbxMeasuredRefPulses.Text; + tbxMeasuredRefPulses.Text = ""; + _backupRefCalibrationResultPulsePerCmStr = tbxRefCalibrationResultPulsePerCm.Text; + tbxRefCalibrationResultPulsePerCm.Text = ""; + _backupWeightScaleVolumeLitersStr = tbxWeightScaleVolumeLiters.Text; + tbxWeightScaleVolumeLiters.Text = ""; + } + // Restore values if REF pulses per cubic meters is back to the calibrated one + else if (tbxRefPulsePerCm.Text.Equals(_backupRefCalibrationResultPulsePerCmStr)) + { + tbxMeasuredRefPulses.Text = _backupMeasuredRefPulsesStr; + tbxRefCalibrationResultPulsePerCm.Text = _backupRefCalibrationResultPulsePerCmStr; + tbxWeightScaleVolumeLiters.Text = _backupWeightScaleVolumeLitersStr; + } } } /// @@ -821,9 +843,9 @@ namespace Sensus.MiniPrf.Ui { // Calculate REF pulses per cubic meter if (int.TryParse(tbxMeasuredRefPulses.Text, out var pulses) && pulses > 0 && - int.TryParse(tbxWeightScaleMass_liters.Text, out var liters) && liters > 0) + int.TryParse(tbxWeightScaleVolumeLiters.Text, out var liters) && liters > 0) { - tbxRefCalibrationResultPulsePerCm.Text = $@"{(UInt16)((Single)pulses / (liters / 1000.0f))}"; + tbxRefCalibrationResultPulsePerCm.Text = $@"{(UInt16)(pulses / (liters / 1000.0f))}"; // Copy from REF pulses per cubic meter in 'Manual REF Calibration' to 'Regulation Setup' if (!tbxRefCalibrationResultPulsePerCm.Text.Equals(tbxRefPulsePerCm.Text)) {