fix precision correct factor (Mexico), added diff, correction in percentage in Result Configuration
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
@@ -33,6 +34,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
private void WaterMeterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
nameLabel.Text = Strings.Name;
|
||||
calibFactorNominalLabel.Text = GetLocalizedString("IperlCalibFactorNominal", "Default calibration factor:");
|
||||
string calibFactorNominalTooltip = GetLocalizedString("IperlCalibFactorNominalTooltip", "Raw calibration factor representing 100 %. This value is used to calculate 'iPerl CalibFactor (%)' in the results configuration.");
|
||||
calibFactorNominalToolTip.SetToolTip(calibFactorNominalLabel, calibFactorNominalTooltip);
|
||||
calibFactorNominalToolTip.SetToolTip(calibFactorNominalTextBox, calibFactorNominalTooltip);
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
Redraw();
|
||||
}
|
||||
@@ -55,6 +60,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
muxBoardNrTextBox.Text = config.MuxBoardNr.ToString();
|
||||
groupTextBox.Text = config.Group.ToString();
|
||||
comboBoxCommunicationInterface.SelectedItem = config.CommunicationInterface.ToString();
|
||||
double nominalCalibFactor = config.CalibFactorNominal > 0.0
|
||||
? config.CalibFactorNominal
|
||||
: IperlHead.DefaultCalibFactorNominal;
|
||||
calibFactorNominalTextBox.Text = nominalCalibFactor.ToString(CultureInfo.CurrentCulture);
|
||||
tabPage2.Controls.Add(new IperlHeadTestCtrl(config));
|
||||
}
|
||||
|
||||
@@ -71,6 +80,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
muxBoardNrTextBox.Enabled = true;
|
||||
groupTextBox.Enabled = true;
|
||||
comboBoxCommunicationInterface.Enabled = true;
|
||||
calibFactorNominalTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@@ -127,6 +137,13 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
message += Environment.NewLine + string.Format(Strings.Invalid_0, groupLabel.Text);
|
||||
}
|
||||
|
||||
double nominalCalibFactor;
|
||||
if (!TryParseDouble(calibFactorNominalTextBox.Text, out nominalCalibFactor) || nominalCalibFactor <= 0.0)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + string.Format(Strings.Invalid_0, calibFactorNominalLabel.Text);
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -155,8 +172,22 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
config.Group = int.Parse(groupTextBox.Text);
|
||||
config.CommunicationInterface = (CommunicationInterface)comboBoxCommunicationInterface.SelectedIndex;
|
||||
config.HeadCommunicationComPortNr = int.Parse(headPortNrTextBox.Text);
|
||||
double nominalCalibFactor;
|
||||
if (TryParseDouble(calibFactorNominalTextBox.Text, out nominalCalibFactor))
|
||||
config.CalibFactorNominal = nominalCalibFactor;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
private static bool TryParseDouble(string value, out double result)
|
||||
{
|
||||
return double.TryParse(value, NumberStyles.Float, CultureInfo.CurrentCulture, out result) ||
|
||||
double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out result);
|
||||
}
|
||||
|
||||
private static string GetLocalizedString(string resourceName, string fallback)
|
||||
{
|
||||
return Strings.ResourceManager.GetString(resourceName, Strings.Culture) ?? fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user