- RegulValve ADC Open/Close values calibration implemented
- 'More' button added to ComponentCfgCtrl-s - Dataflow from ComponentParametersDlg to components: CfgChangeHandler - Dataflow from components to ComponentParametersDlg: CmdResponseHandler - Detection of parameter changes and appropriate MesssageBox display: 1.warning message when component configuration change requires program restart 2.confirmation message box when any configuration changes would be lost
This commit is contained in:
@@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(ValveCfgCtrl));
|
||||
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
ValveCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
@@ -57,6 +60,10 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
@@ -88,9 +95,11 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
lagClosingTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public void UpdateCfg()
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
|
||||
@@ -108,46 +117,48 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
config.InvertCouple = invertCoupleCheckBox.Checked;
|
||||
config.LagOpening = int.Parse(lagOpeningTextBox.Text);
|
||||
config.LagClosing = int.Parse(lagClosingTextBox.Text);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgVerifyFlags VerifyCfg(ref string message)
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgVerifyFlags flags = CfgVerifyFlags.None;
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
|
||||
|
||||
int dummy;
|
||||
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Parent Name'";
|
||||
}
|
||||
if (!categoryComboBox.Items.Contains(categoryComboBox.Text))
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Category'";
|
||||
}
|
||||
if (!coupledToComboBox.Items.Contains(coupledToComboBox.Text))
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Coupled To'";
|
||||
}
|
||||
if (!int.TryParse(bitPositionTextBox.Text, out dummy) || dummy < 0 || dummy >= 64)
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Bit Position' should be between 0 and 63";
|
||||
}
|
||||
if (!int.TryParse(openCloseTimeTextBox.Text, out dummy) || dummy < 0 || dummy > 300)
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Open/close time' should be between 0 and 300 s";
|
||||
}
|
||||
if (!int.TryParse(lagOpeningTextBox.Text, out dummy))
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Delay when opening' error";
|
||||
}
|
||||
if (!int.TryParse(lagClosingTextBox.Text, out dummy))
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Delay when closing' error";
|
||||
}
|
||||
return flags;
|
||||
|
||||
Reference in New Issue
Block a user