- 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:
@@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(FlowMeterCfgCtrl));
|
||||
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
FlowMeterCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
@@ -46,6 +49,10 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
@@ -65,38 +72,42 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
nominalFlowTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
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 (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 1 || dummy > 7)
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Idx1' should be between 1 and 7";
|
||||
}
|
||||
float fdummy;
|
||||
if (!Utils.TryParseUFloat(nominalFlowTextBox.Text, out fdummy) || fdummy < 0.2 || fdummy > 1600)
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Nominal flow' should be between 0.2 and 1600";
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
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;
|
||||
config.Idx1 = int.Parse(positionTextBox.Text);
|
||||
Utils.TryParseUFloat(nominalFlowTextBox.Text, out config.NominalFlow);
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user