- possibility to invert valves (UI as well as the functionality)

- UI prepared for the usage of valve delays
This commit is contained in:
Milan Hanajik
2014-09-06 07:37:27 +02:00
parent 74a6800f9e
commit 6933442e76
7 changed files with 122 additions and 60 deletions
@@ -65,9 +65,11 @@ namespace TBF.BenchControl.Elde.Valve
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
bitPositionTextBox.Text = config.BitPosition.ToString();
invertedCheckBox.Checked = config.Inverted;
openCloseTimeTextBox.Text = config.OpenCloseTime.ToString();
categoryComboBox.Text = config.Category.ToString();
coupledToComboBox.Text = string.IsNullOrEmpty(config.CoupledToName) ? "---" : config.CoupledToName;
invertCheckBox.Checked = config.Invert;
invertCoupleCheckBox.Checked = config.InvertCouple;
lagOpeningTextBox.Text = config.LagOpening.ToString();
lagClosingTextBox.Text = config.LagClosing.ToString();
}
@@ -77,9 +79,11 @@ namespace TBF.BenchControl.Elde.Valve
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
bitPositionTextBox.Enabled = true;
invertedCheckBox.Enabled = true;
openCloseTimeTextBox.Enabled = true;
categoryComboBox.Enabled = true;
coupledToComboBox.Enabled = true;
invertCheckBox.Enabled = true;
invertCoupleCheckBox.Enabled = true;
lagOpeningTextBox.Enabled = true;
lagClosingTextBox.Enabled = true;
}
@@ -91,15 +95,17 @@ namespace TBF.BenchControl.Elde.Valve
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.BitPosition = int.Parse(bitPositionTextBox.Text);
config.OpenCloseTime = int.Parse(openCloseTimeTextBox.Text);
config.Inverted = invertedCheckBox.Checked;
if (categoryComboBox.Text.Equals(ValveCategory.All.ToString())) config.Category = ValveCategory.All;
if (categoryComboBox.Text.Equals(ValveCategory.All.ToString())) config.Category = ValveCategory.All;
else if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) config.Category = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Bench.ToString())) config.Category = ValveCategory.Bench;
else if (categoryComboBox.Text.Equals(ValveCategory.Bench.ToString())) config.Category = ValveCategory.Bench;
else if (categoryComboBox.Text.Equals(ValveCategory.Output.ToString())) config.Category = ValveCategory.Output;
else config.Category = ValveCategory.None;
config.CoupledToName = coupledToComboBox.Text.Equals("---") ? string.Empty : coupledToComboBox.Text;
config.Invert = invertCheckBox.Checked;
config.InvertCouple = invertCoupleCheckBox.Checked;
config.LagOpening = int.Parse(lagOpeningTextBox.Text);
config.LagClosing = int.Parse(lagClosingTextBox.Text);
}
@@ -129,7 +135,12 @@ namespace TBF.BenchControl.Elde.Valve
flags |= CfgVerifyFlags.Error;
message += Environment.NewLine + "'Bit Position' should be between 0 and 63";
}
if (!int.TryParse(lagOpeningTextBox.Text, out dummy))
if (!int.TryParse(openCloseTimeTextBox.Text, out dummy) || dummy < 0 || dummy > 300)
{
flags |= CfgVerifyFlags.Error;
message += Environment.NewLine + "'Open/close time' should be between 0 and 300 s";
}
if (!int.TryParse(lagOpeningTextBox.Text, out dummy))
{
flags |= CfgVerifyFlags.Error;
message += Environment.NewLine + "'Delay when opening' error";