MettlerToledo.Multi drain valve fixes (BalanceDev, BalanceCfg, etc. changes), ver. 2.18.794

This commit is contained in:
Milan Hanajik
2018-01-31 11:16:29 +01:00
parent 95ad2484ef
commit 2bc8a5629f
7 changed files with 424 additions and 378 deletions
@@ -15,6 +15,8 @@ namespace TBF.BenchControl.MettlerToledo.Multi
{
static readonly ILog log = LogManager.GetLogger(typeof(BalanceCfgCtrl));
ComponentParametersDlg parent;
public bool ShowMore { get { return false; } }
BalanceCfg config;
@@ -95,7 +97,22 @@ namespace TBF.BenchControl.MettlerToledo.Multi
private void BalanceCfgCtrl_Load(object sender, EventArgs e)
{
Redraw();
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
{
drainValveComboBox.Items.Add("---");
foreach (var cmpnt in parent.TbfComponents)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.Valve.ValveFactory)
{
drainValveComboBox.Items.Add(cmpnt.Name);
}
}
}
Redraw();
}
public void Closing()
@@ -113,7 +130,8 @@ namespace TBF.BenchControl.MettlerToledo.Multi
resolutionTextBox.Text = config.Resolution.ToString();
emptyTextBox.Text = config.Empty.ToString();
formatTextBox.Text = (config.Format.Length > 1) ? config.Format.Substring(1) : config.Format;
emptyTimeTextBox.Text = config.EmptyTimeSec.ToString();
emptyTimeTextBox.Text = config.DrainTimeSec.ToString();
drainValveComboBox.Text = string.IsNullOrEmpty(config.DrainValve) ? "---" : config.DrainValve;
comPortNrTextBox.Text = config.ComPortNr.ToString();
baudRateTextBox.Text = config.BaudRate.ToString();
@@ -133,6 +151,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
emptyTextBox.Enabled = true;
formatTextBox.Enabled = true;
emptyTimeTextBox.Enabled = true;
drainValveComboBox.Enabled = true;
comPortNrTextBox.Enabled = true;
baudRateTextBox.Enabled = true;
@@ -181,6 +200,11 @@ namespace TBF.BenchControl.MettlerToledo.Multi
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank Empty Time' should be between 1 and 999 sec";
}
if (!drainValveComboBox.Items.Contains(drainValveComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Drain valve'";
}
if (idNr == 1)
{
@@ -217,7 +241,8 @@ namespace TBF.BenchControl.MettlerToledo.Multi
config.Resolution = Utils.ParseUFloat(resolutionTextBox.Text);
config.Empty = Utils.ParseUFloat(emptyTextBox.Text);
config.Format = "F" + formatTextBox.Text;
config.EmptyTimeSec = int.Parse(emptyTimeTextBox.Text);
config.DrainTimeSec = int.Parse(emptyTimeTextBox.Text);
config.DrainValve = drainValveComboBox.Text.Equals("---") ? string.Empty : drainValveComboBox.Text;
if (config.IdNr == 1)
{