Mass values are printed out using format specified by Balance component parameters
This commit is contained in:
@@ -104,29 +104,33 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
capacityTextBox.Text = config.Capacity.ToString();
|
||||
emptyTextBox.Text = config.Empty.ToString();
|
||||
formatTextBox.Text = (config.Format.Length > 1) ? config.Format.Substring(1) : config.Format;
|
||||
emptyTimeTextBox.Text = config.EmptyTimeSec.ToString();
|
||||
|
||||
comPortNrTextBox.Text = config.ComPortNr.ToString();
|
||||
baudRateTextBox.Text = config.BaudRate.ToString();
|
||||
parityComboBox.Text = config.Parity.ToString();
|
||||
dataBitsTextBox.Text = config.DataBits.ToString();
|
||||
stopBitsComboBox.Text = config.StopBits.ToString();
|
||||
handshakeComboBox.Text = config.Handshake.ToString();
|
||||
capacityTextBox.Text = config.Capacity.ToString();
|
||||
emptyTextBox.Text = config.Empty.ToString();
|
||||
emptyTimeTextBox.Text = config.EmptyTimeSec.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
capacityTextBox.Enabled = true;
|
||||
emptyTextBox.Enabled = true;
|
||||
formatTextBox.Enabled = true;
|
||||
emptyTimeTextBox.Enabled = true;
|
||||
|
||||
comPortNrTextBox.Enabled = true;
|
||||
baudRateTextBox.Enabled = true;
|
||||
parityComboBox.Enabled = true;
|
||||
dataBitsTextBox.Enabled = true;
|
||||
stopBitsComboBox.Enabled = true;
|
||||
handshakeComboBox.Enabled = true;
|
||||
capacityTextBox.Enabled = true;
|
||||
emptyTextBox.Enabled = true;
|
||||
emptyTimeTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@@ -160,6 +164,11 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Tank Empty' is not valid";
|
||||
}
|
||||
if (!int.TryParse(formatTextBox.Text, out dummy) || dummy < 0 || dummy > 9)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Decimal points' should be between 0 and 9";
|
||||
}
|
||||
if (!int.TryParse(emptyTimeTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
@@ -176,15 +185,17 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.Capacity = Utils.ParseUFloat(capacityTextBox.Text);
|
||||
config.Empty = Utils.ParseUFloat(emptyTextBox.Text);
|
||||
config.Format = "F" + formatTextBox.Text;
|
||||
config.EmptyTimeSec = int.Parse(emptyTimeTextBox.Text);
|
||||
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
config.Capacity = Utils.ParseUFloat(capacityTextBox.Text);
|
||||
config.Empty = Utils.ParseUFloat(emptyTextBox.Text);
|
||||
config.EmptyTimeSec = int.Parse(emptyTimeTextBox.Text);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user