Balance empty mass is configurable
This commit is contained in:
@@ -102,8 +102,9 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
dataBitsTextBox.Text = config.DataBits.ToString();
|
||||
stopBitsComboBox.Text = config.StopBits.ToString();
|
||||
handshakeComboBox.Text = config.Handshake.ToString();
|
||||
rangeTextBox.Text = config.Capacity.ToString();
|
||||
}
|
||||
capacityTextBox.Text = config.Capacity.ToString();
|
||||
emptyTextBox.Text = config.Empty.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
@@ -114,8 +115,9 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
dataBitsTextBox.Enabled = true;
|
||||
stopBitsComboBox.Enabled = true;
|
||||
handshakeComboBox.Enabled = true;
|
||||
rangeTextBox.Enabled = true;
|
||||
}
|
||||
capacityTextBox.Enabled = true;
|
||||
emptyTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgVerifyFlags VerifyCfg(ref string message)
|
||||
{
|
||||
@@ -137,14 +139,17 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
message += Environment.NewLine + "'Data Bits' is not valid";
|
||||
}
|
||||
float fdummy;
|
||||
bool floatOk = (float.TryParse(rangeTextBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out fdummy) ||
|
||||
float.TryParse(rangeTextBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out fdummy));
|
||||
if (!floatOk || fdummy <= 0)
|
||||
float mass;
|
||||
if (!Utils.TryParseUFloat(capacityTextBox.Text, out mass) || mass <= 0)
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
message += Environment.NewLine + "'Range' is not valid";
|
||||
message += Environment.NewLine + "'Tank Capacity' is not valid";
|
||||
}
|
||||
if (!Utils.TryParseUFloat(emptyTextBox.Text, out mass) || mass <= 0)
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
message += Environment.NewLine + "'Tank Empty' is not valid";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
@@ -160,8 +165,8 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
bool floatOk = (float.TryParse(rangeTextBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out config.Capacity) ||
|
||||
float.TryParse(rangeTextBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out config.Capacity));
|
||||
config.Capacity = Utils.ParseUFloat(capacityTextBox.Text);
|
||||
config.Empty = Utils.ParseUFloat(emptyTextBox.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user