diff --git a/TestBenchFramework/BenchControl/BenchId/ComponentCfgCtrl.cs b/TestBenchFramework/BenchControl/BenchId/ComponentCfgCtrl.cs
index bc8d040a1..2efd8e47a 100644
--- a/TestBenchFramework/BenchControl/BenchId/ComponentCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/BenchId/ComponentCfgCtrl.cs
@@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
+using log4net;
using TBF.BenchControl.Generic;
using TBF.Resources;
@@ -7,8 +8,11 @@ namespace TBF.BenchControl.BenchId
{
public partial class ComponentCfgCtrl : UserControl, IComponentCfgCtrl
{
- ComponentCfg config;
+ static readonly ILog log = LogManager.GetLogger(typeof(ComponentCfgCtrl));
+ public bool ShowMore { get { return false; } }
+
+ ComponentCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +35,10 @@ namespace TBF.BenchControl.BenchId
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -45,19 +53,24 @@ namespace TBF.BenchControl.BenchId
numberTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
try { config.TestBenchNr = int.Parse(numberTextBox.Text); }
catch { config.TestBenchNr = 1; }
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiCfgCtrl.cs b/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiCfgCtrl.cs
index be098693f..963a3e7a8 100644
--- a/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiCfgCtrl.cs
@@ -1,14 +1,19 @@
using System;
using System.Windows.Forms;
using System.IO.Ports;
+using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Cameras.CameraRoi
{
public partial class CameraRoiCfgCtrl : UserControl, IComponentCfgCtrl
{
+ static readonly ILog log = LogManager.GetLogger(typeof(CameraRoiCfgCtrl));
+
ComponentParametersDlg parent;
+ public bool ShowMore { get { return false; } }
+
CameraRoiCfg config;
public IComponentCfg Config
{
@@ -45,6 +50,10 @@ namespace TBF.BenchControl.Cameras.CameraRoi
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -62,33 +71,37 @@ namespace TBF.BenchControl.Cameras.CameraRoi
roiTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
int dummy;
if (!int.TryParse(roiTextBox.Text, out dummy) || dummy < 1 || dummy > 4)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Region of Interest' is not valid";
}
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.RoiNr = int.Parse(roiTextBox.Text);
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfgCtrl.cs b/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfgCtrl.cs
index f15593e63..394d5ce84 100644
--- a/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfgCtrl.cs
@@ -1,14 +1,18 @@
using System;
using System.Windows.Forms;
using System.IO.Ports;
+using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Cameras.IdcCamera
{
public partial class IdcCameraCfgCtrl : UserControl, IComponentCfgCtrl
{
- IdcCameraCfg config;
+ static readonly ILog log = LogManager.GetLogger(typeof(IdcCameraCfgCtrl));
+ public bool ShowMore { get { return false; } }
+
+ IdcCameraCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -32,6 +36,10 @@ namespace TBF.BenchControl.Cameras.IdcCamera
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -51,38 +59,42 @@ namespace TBF.BenchControl.Cameras.IdcCamera
brightnessTextBox.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 (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Serial Port Number' is not valid";
}
if (!int.TryParse(baudRateComboBox.Text, out dummy) || ((dummy != 57600) && (dummy != 115200)))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Baud Rate' should be 57600 or 115200 Bd";
}
if (!int.TryParse(brightnessTextBox.Text, out dummy) || dummy < 0 || dummy > 100)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Brightness' should be between 0 and 100 %";
}
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.ComPortNr = int.Parse(comPortNrTextBox.Text);
config.BaudRate = int.Parse(baudRateComboBox.Text);
config.BrightnessCam = ((float)int.Parse(brightnessTextBox.Text) / 100.0f);
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/CfgChangeArgs.cs b/TestBenchFramework/BenchControl/CfgChangeArgs.cs
new file mode 100644
index 000000000..578337a5f
--- /dev/null
+++ b/TestBenchFramework/BenchControl/CfgChangeArgs.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace TBF.BenchControl
+{
+ public class CfgChangeArgs : EventArgs
+ {
+ public CfgChangeCmd Command;
+ public Generic.IComponentCfg Cfg;
+
+ public CfgChangeArgs(CfgChangeCmd command, Generic.IComponentCfg cfg)
+ {
+ Command = command;
+ Cfg = cfg;
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/CmdResponseArgs.cs b/TestBenchFramework/BenchControl/CmdResponseArgs.cs
new file mode 100644
index 000000000..62c656b15
--- /dev/null
+++ b/TestBenchFramework/BenchControl/CmdResponseArgs.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace TBF.BenchControl
+{
+ public class CmdResponseArgs : EventArgs
+ {
+ public CfgChangeCmd Command;
+ public int Response;
+
+ public CmdResponseArgs(CfgChangeCmd command, int response)
+ {
+ Command = command;
+ Response = response;
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/ComponentBase.cs b/TestBenchFramework/BenchControl/ComponentBase.cs
index e8b1e002b..1d44b67f1 100644
--- a/TestBenchFramework/BenchControl/ComponentBase.cs
+++ b/TestBenchFramework/BenchControl/ComponentBase.cs
@@ -26,11 +26,13 @@ namespace TBF.BenchControl
this.cfg = cfg;
}
- ///
- /// Empty implementation, might be overriden in derived classes
- ///
- public static void ResetStaticProperties()
- {
- }
+ /// Empty implementation, might be overriden in derived classes
+ public static void ResetStaticProperties() { }
+
+ /// Empty implementation, might be overriden in derived classes
+ public virtual void StartChangeHandler() { }
+
+ /// Empty implementation, might be overriden in derived classes
+ public virtual void StopChangeHandler() { }
}
}
diff --git a/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormCfgCtrl.cs b/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormCfgCtrl.cs
index abf86915a..1f709dbff 100644
--- a/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.DataEntry.Munich
{
static readonly ILog log = LogManager.GetLogger(typeof(EntryFormCfgCtrl));
- EntryFormCfg config;
+ public bool ShowMore { get { return false; } }
+ EntryFormCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.DataEntry.Munich
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -49,19 +54,24 @@ namespace TBF.BenchControl.DataEntry.Munich
protocolTitle3TextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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.ProtocolTitle1 = protocolTitle1TextBox.Text;
config.ProtocolTitle2 = protocolTitle2TextBox.Text;
config.ProtocolTitle3 = protocolTitle3TextBox.Text;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormCfgCtrl.cs b/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormCfgCtrl.cs
index 27a8956d6..d26928b79 100644
--- a/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.DataEntry.Munich3
{
static readonly ILog log = LogManager.GetLogger(typeof(EntryFormCfgCtrl));
- EntryFormCfg config;
+ public bool ShowMore { get { return false; } }
+ EntryFormCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.DataEntry.Munich3
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -49,19 +54,24 @@ namespace TBF.BenchControl.DataEntry.Munich3
protocolTitle3TextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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.ProtocolTitle1 = protocolTitle1TextBox.Text;
config.ProtocolTitle2 = protocolTitle2TextBox.Text;
config.ProtocolTitle3 = protocolTitle3TextBox.Text;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.cs b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.cs
index b4d7bd87c..57cf9524d 100644
--- a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.DataEntry.WMStates
{
static readonly ILog log = LogManager.GetLogger(typeof(EntryFormCfgCtrl));
- EntryFormCfg config;
+ public bool ShowMore { get { return false; } }
+ EntryFormCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.DataEntry.WMStates
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.DataEntry.WMStates
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/ControlBoardCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/ControlBoardCfgCtrl.cs
index 31100cbbc..dfab79120 100644
--- a/TestBenchFramework/BenchControl/Elde/ControlBoardCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/ControlBoardCfgCtrl.cs
@@ -1,11 +1,16 @@
using System;
using System.Windows.Forms;
+using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde
{
public partial class ControlBoardCfgCtrl : UserControl, IComponentCfgCtrl
{
+ static readonly ILog log = LogManager.GetLogger(typeof(ControlBoardCfgCtrl));
+
+ public bool ShowMore { get { return false; } }
+
ControlBoardCfg config;
public IComponentCfg Config
{
@@ -27,6 +32,10 @@ namespace TBF.BenchControl.Elde
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -47,15 +56,15 @@ namespace TBF.BenchControl.Elde
/// Called when user wants to close/save the configuration.
///
/// See VerifyFlags
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
int dummy;
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy <= 0 || dummy > 999)
{
message += "Control board serial port number is invalid";
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
}
return flags;
@@ -64,12 +73,16 @@ namespace TBF.BenchControl.Elde
///
/// Save settings to the configuration class.
///
- 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
+
this.Name = nameTextBox.Text;
this.config.ComPortNr = int.Parse(comPortNrTextBox.Text);
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/Diverter/DiverterCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/Diverter/DiverterCfgCtrl.cs
index b21753414..8bb086e07 100644
--- a/TestBenchFramework/BenchControl/Elde/Diverter/DiverterCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/Diverter/DiverterCfgCtrl.cs
@@ -1,12 +1,18 @@
using System;
using System.Windows.Forms;
+using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.Diverter
{
public partial class DiverterCfgCtrl : UserControl, IComponentCfgCtrl
{
+ static readonly ILog log = LogManager.GetLogger(typeof(DiverterCfgCtrl));
+
ComponentParametersDlg parent;
+
+ public bool ShowMore { get { return false; } }
+
DiverterCfg config;
public IComponentCfg Config
{
@@ -42,6 +48,10 @@ namespace TBF.BenchControl.Elde.Diverter
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -59,31 +69,35 @@ namespace TBF.BenchControl.Elde.Diverter
bitPositionTextBox.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(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";
}
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.BitPosition = int.Parse(bitPositionTextBox.Text);
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderCfgCtrl.cs
index 0379d103d..326c4f9c5 100644
--- a/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderCfgCtrl.cs
@@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
static readonly ILog log = LogManager.GetLogger(typeof(RegisterReaderCfgCtrl));
ComponentParametersDlg parent;
+
+ public bool ShowMore { get { return false; } }
+
RegisterReaderCfg config;
public IComponentCfg Config
{
@@ -45,6 +48,10 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -60,24 +67,28 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
parentNameComboBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterCfgCtrl.cs
index 2b0b2768c..83b2018aa 100644
--- a/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterCfgCtrl.cs
@@ -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;
+ }
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterCfgCtrl.cs
index 885785beb..e0a690693 100644
--- a/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterCfgCtrl.cs
@@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
static readonly ILog log = LogManager.GetLogger(typeof(FlowMeterCfgCtrl));
ComponentParametersDlg parent;
+
+ public bool ShowMore { get { return false; } }
+
FlowMeterCfg config;
public IComponentCfg Config
{
@@ -51,6 +54,10 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -72,43 +79,47 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
nominalFlowTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!flowMeter1ComboBox.Items.Contains(flowMeter1ComboBox.Text))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Flow Meter 1'";
}
if (!flowMeter2ComboBox.Items.Contains(flowMeter2ComboBox.Text))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Flow Meter 2'";
}
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.FlowMeter1 = flowMeter1ComboBox.Text.Equals("---") ? string.Empty : flowMeter1ComboBox.Text;
config.FlowMeter2 = flowMeter2ComboBox.Text.Equals("---") ? string.Empty : flowMeter2ComboBox.Text;
Utils.TryParseUFloat(nominalFlowTextBox.Text, out config.NominalFlow);
- }
+
+ return flags;
+ }
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterCfgCtrl.cs
index 407c7e60d..028296c8d 100644
--- a/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterCfgCtrl.cs
@@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.PressureMeter
static readonly ILog log = LogManager.GetLogger(typeof(PressureMeterCfgCtrl));
ComponentParametersDlg parent;
+
+ public bool ShowMore { get { return false; } }
+
PressureMeterCfg config;
public IComponentCfg Config
{
@@ -45,6 +48,10 @@ namespace TBF.BenchControl.Elde.PressureMeter
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -64,37 +71,41 @@ namespace TBF.BenchControl.Elde.PressureMeter
rs485AddressTextBox.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 < 0 || dummy > 7)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Position' should be between 0 and 7";
}
if (!int.TryParse(rs485AddressTextBox.Text, out dummy) || dummy < 0 || dummy > 255)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'RS485 Address' should be between 0 and 255";
}
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.Idx0 = int.Parse(positionTextBox.Text);
config.RS485Address = (byte)int.Parse(rs485AddressTextBox.Text);
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs
index f32913b62..d7b096e1c 100644
--- a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfgCtrl.cs
@@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.Pump
static readonly ILog log = LogManager.GetLogger(typeof(PumpCfgCtrl));
ComponentParametersDlg parent;
+
+ public bool ShowMore { get { return false; } }
+
PumpCfg config;
public IComponentCfg Config
{
@@ -45,6 +48,10 @@ namespace TBF.BenchControl.Elde.Pump
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -64,34 +71,38 @@ namespace TBF.BenchControl.Elde.Pump
delayTextBox.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;
config.BitPosition = int.Parse(bitPositionTextBox.Text);
config.Delay = int.Parse(delayTextBox.Text);
- }
- public CfgVerifyFlags VerifyCfg(ref string message)
+ return flags;
+ }
+
+ 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(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(delayTextBox.Text, out dummy) || dummy < 0 || dummy >= 300)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Delay' should be between 0 and 300s (5min)";
}
return flags;
diff --git a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs
index 5afdd75a8..bf50900c0 100644
--- a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfgCtrl.cs
@@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.PumpWithFM
static readonly ILog log = LogManager.GetLogger(typeof(PumpCfgCtrl));
ComponentParametersDlg parent;
+
+ public bool ShowMore { get { return false; } }
+
PumpCfg config;
public IComponentCfg Config
{
@@ -45,6 +48,10 @@ namespace TBF.BenchControl.Elde.PumpWithFM
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -66,40 +73,44 @@ namespace TBF.BenchControl.Elde.PumpWithFM
delayTextBox.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;
config.BitPosition = int.Parse(bitPositionTextBox.Text);
config.FMIndex = int.Parse(fmIndexTextBox.Text);
config.Delay = int.Parse(delayTextBox.Text);
- }
- public CfgVerifyFlags VerifyCfg(ref string message)
+ return flags;
+ }
+
+ 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(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(fmIndexTextBox.Text, out dummy) || dummy < 0)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'FM Index' should be between 0 and FMPumpsCount - 1";
}
if (!int.TryParse(delayTextBox.Text, out dummy) || dummy < 0 || dummy >= 300)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Delay' should be between 0 and 300s (5min)";
}
return flags;
diff --git a/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderCfgCtrl.cs
index 1b16eac7a..6d71dcadf 100644
--- a/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderCfgCtrl.cs
@@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.RegisterReader
static readonly ILog log = LogManager.GetLogger(typeof(RegisterReaderCfgCtrl));
ComponentParametersDlg parent;
+
+ public bool ShowMore { get { return false; } }
+
RegisterReaderCfg config;
public IComponentCfg Config
{
@@ -45,6 +48,10 @@ namespace TBF.BenchControl.Elde.RegisterReader
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -62,31 +69,35 @@ namespace TBF.BenchControl.Elde.RegisterReader
positionTextBox.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))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Position' should be >= 1";
}
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.Position = int.Parse(positionTextBox.Text);
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs
index 5ab7164df..5c0247b7f 100644
--- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs
+++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs
@@ -29,6 +29,56 @@ namespace TBF.BenchControl.Elde.RegulValve
get { return controlBoard.RValvePosition(Idx1); }
}
+
+ #region Configuration Change Handling
+
+ public static void OnCfgChange(object sender, CfgChangeArgs args)
+ {
+ if (CfgChangeHandler == null) return;
+ try { CfgChangeHandler(sender, args); }
+ catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
+ }
+
+ public static event EventHandler CfgChangeHandler;
+
+ public override void StartChangeHandler()
+ {
+ CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
+ {
+ RegulValveCfg tmpcfg = args.Cfg as RegulValveCfg;
+ if (tmpcfg != null && tmpcfg.Name.Equals(Name))
+ {
+ if (args.Command == CfgChangeCmd.CfgChange)
+ {
+ RegulValveCfg.PidCoef = tmpcfg.PidCoef;
+ RegulValveCfg.StableTimeMs = tmpcfg.StableTimeMs;
+ RegulValveCfg.FlowStableSec = tmpcfg.FlowStableSec;
+ }
+ else if (args.Command == CfgChangeCmd.RVOpenStep)
+ {
+ controlBoard.ValveMove(Idx1, RegulValveMode.PulseWidth, new float[2] { 0.05f, 0.05f }, StableTime);
+ // TODO: avoid conflicts
+ // TOTEST
+ }
+ else if (args.Command == CfgChangeCmd.RVCloseStep)
+ {
+ controlBoard.ValveMove(Idx1, RegulValveMode.PulseWidth, new float[2] { -0.05f, -0.05f }, StableTime);
+ // TODO: avoid conflicts
+ // TOTEST
+ }
+ else if (args.Command == CfgChangeCmd.GetRVAdc1 || args.Command == CfgChangeCmd.GetRVAdc2)
+ {
+ int adc = (int)controlBoard.AnalogInputRaw(Idx1, 0);
+ // TOTEST
+ RegulValveCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, adc));
+ }
+ }
+ };
+ }
+
+ #endregion Configuration Change Handling
+
+
public RegulValve(RegulValveCfg cfg, IList components)
: base(cfg)
{
diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgChangeArgs.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgChangeArgs.cs
new file mode 100644
index 000000000..752fb9d1c
--- /dev/null
+++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgChangeArgs.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace TBF.BenchControl.Elde.RegulValve
+{
+ public class RegulValveCfgChangeArgs : EventArgs
+ {
+ public CfgChangeCmd Command;
+ public Generic.IComponentCfg Cfg;
+
+ public RegulValveCfgChangeArgs(CfgChangeCmd command, Generic.IComponentCfg cfg)
+ {
+ Command = command;
+ Cfg = cfg;
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.Designer.cs
index 2fd815345..6195b608d 100644
--- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.Designer.cs
+++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.Designer.cs
@@ -28,210 +28,403 @@
///
private void InitializeComponent()
{
- this.positionTextBox = new System.Windows.Forms.TextBox();
- this.positionLabel = new System.Windows.Forms.Label();
- this.parentNameLabel = new System.Windows.Forms.Label();
- this.nameTextBox = new System.Windows.Forms.TextBox();
- this.nameLabel = new System.Windows.Forms.Label();
- this.classNameLabel = new System.Windows.Forms.Label();
- this.dacClosedLabel = new System.Windows.Forms.Label();
- this.dacClosedTextBox = new System.Windows.Forms.TextBox();
- this.dacOpenTextBox = new System.Windows.Forms.TextBox();
- this.dacOpenLabel = new System.Windows.Forms.Label();
- this.parentNameComboBox = new System.Windows.Forms.ComboBox();
- this.pidCoefLabel = new System.Windows.Forms.Label();
- this.pidCoefTextBox = new System.Windows.Forms.TextBox();
- this.storedPosReuseCheckBox = new System.Windows.Forms.CheckBox();
- this.stableTimeTextBox = new System.Windows.Forms.TextBox();
- this.stableTimeLabel = new System.Windows.Forms.Label();
- this.flowStableSecTextBox = new System.Windows.Forms.TextBox();
- this.flowStableSecLabel = new System.Windows.Forms.Label();
- this.SuspendLayout();
- //
- // positionTextBox
- //
- this.positionTextBox.Enabled = false;
- this.positionTextBox.Location = new System.Drawing.Point(138, 78);
- this.positionTextBox.Name = "positionTextBox";
- this.positionTextBox.Size = new System.Drawing.Size(46, 20);
- this.positionTextBox.TabIndex = 6;
- //
- // positionLabel
- //
- this.positionLabel.AutoSize = true;
- this.positionLabel.Location = new System.Drawing.Point(28, 81);
- this.positionLabel.Name = "positionLabel";
- this.positionLabel.Size = new System.Drawing.Size(18, 13);
- this.positionLabel.TabIndex = 5;
- this.positionLabel.Text = "ID";
- //
- // parentNameLabel
- //
- this.parentNameLabel.AutoSize = true;
- this.parentNameLabel.Location = new System.Drawing.Point(28, 57);
- this.parentNameLabel.Name = "parentNameLabel";
- this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
- this.parentNameLabel.TabIndex = 3;
- this.parentNameLabel.Text = "Parent Name";
- //
- // nameTextBox
- //
- this.nameTextBox.Enabled = false;
- this.nameTextBox.Location = new System.Drawing.Point(138, 30);
- this.nameTextBox.Name = "nameTextBox";
- this.nameTextBox.Size = new System.Drawing.Size(130, 20);
- this.nameTextBox.TabIndex = 2;
- //
- // nameLabel
- //
- this.nameLabel.AutoSize = true;
- this.nameLabel.Location = new System.Drawing.Point(28, 33);
- this.nameLabel.Name = "nameLabel";
- this.nameLabel.Size = new System.Drawing.Size(35, 13);
- this.nameLabel.TabIndex = 1;
- this.nameLabel.Text = "Name";
- //
- // classNameLabel
- //
- this.classNameLabel.AutoSize = true;
- this.classNameLabel.Location = new System.Drawing.Point(135, 9);
- this.classNameLabel.Name = "classNameLabel";
- this.classNameLabel.Size = new System.Drawing.Size(89, 13);
- this.classNameLabel.TabIndex = 0;
- this.classNameLabel.Text = "ComponentName";
- //
- // dacClosedLabel
- //
- this.dacClosedLabel.AutoSize = true;
- this.dacClosedLabel.Location = new System.Drawing.Point(28, 104);
- this.dacClosedLabel.Name = "dacClosedLabel";
- this.dacClosedLabel.Size = new System.Drawing.Size(93, 13);
- this.dacClosedLabel.TabIndex = 7;
- this.dacClosedLabel.Text = "DAC when Closed";
- //
- // dacClosedTextBox
- //
- this.dacClosedTextBox.Enabled = false;
- this.dacClosedTextBox.Location = new System.Drawing.Point(138, 101);
- this.dacClosedTextBox.Name = "dacClosedTextBox";
- this.dacClosedTextBox.Size = new System.Drawing.Size(46, 20);
- this.dacClosedTextBox.TabIndex = 8;
- //
- // dacOpenTextBox
- //
- this.dacOpenTextBox.Enabled = false;
- this.dacOpenTextBox.Location = new System.Drawing.Point(138, 124);
- this.dacOpenTextBox.Name = "dacOpenTextBox";
- this.dacOpenTextBox.Size = new System.Drawing.Size(46, 20);
- this.dacOpenTextBox.TabIndex = 10;
- //
- // dacOpenLabel
- //
- this.dacOpenLabel.AutoSize = true;
- this.dacOpenLabel.Location = new System.Drawing.Point(28, 127);
- this.dacOpenLabel.Name = "dacOpenLabel";
- this.dacOpenLabel.Size = new System.Drawing.Size(87, 13);
- this.dacOpenLabel.TabIndex = 9;
- this.dacOpenLabel.Text = "DAC when Open";
- //
- // parentNameComboBox
- //
- this.parentNameComboBox.Enabled = false;
- this.parentNameComboBox.FormattingEnabled = true;
- this.parentNameComboBox.Location = new System.Drawing.Point(138, 54);
- this.parentNameComboBox.Name = "parentNameComboBox";
- this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
- this.parentNameComboBox.TabIndex = 4;
- //
- // pidCoefLabel
- //
- this.pidCoefLabel.AutoSize = true;
- this.pidCoefLabel.Location = new System.Drawing.Point(28, 150);
- this.pidCoefLabel.Name = "pidCoefLabel";
- this.pidCoefLabel.Size = new System.Drawing.Size(78, 13);
- this.pidCoefLabel.TabIndex = 11;
- this.pidCoefLabel.Text = "PID Coefficient";
- //
- // pidCoefTextBox
- //
- this.pidCoefTextBox.Enabled = false;
- this.pidCoefTextBox.Location = new System.Drawing.Point(138, 147);
- this.pidCoefTextBox.Name = "pidCoefTextBox";
- this.pidCoefTextBox.Size = new System.Drawing.Size(46, 20);
- this.pidCoefTextBox.TabIndex = 12;
- //
- // storedPosReuseCheckBox
- //
- this.storedPosReuseCheckBox.AutoSize = true;
- this.storedPosReuseCheckBox.Enabled = false;
- this.storedPosReuseCheckBox.Location = new System.Drawing.Point(31, 196);
- this.storedPosReuseCheckBox.Name = "storedPosReuseCheckBox";
- this.storedPosReuseCheckBox.Size = new System.Drawing.Size(162, 17);
- this.storedPosReuseCheckBox.TabIndex = 13;
- this.storedPosReuseCheckBox.Text = "Enable stored position re-use";
- this.storedPosReuseCheckBox.UseVisualStyleBackColor = true;
- //
- // stableTimeTextBox
- //
- this.stableTimeTextBox.Enabled = false;
- this.stableTimeTextBox.Location = new System.Drawing.Point(138, 170);
- this.stableTimeTextBox.Name = "stableTimeTextBox";
- this.stableTimeTextBox.Size = new System.Drawing.Size(46, 20);
- this.stableTimeTextBox.TabIndex = 15;
- //
- // stableTimeLabel
- //
- this.stableTimeLabel.AutoSize = true;
- this.stableTimeLabel.Location = new System.Drawing.Point(28, 173);
- this.stableTimeLabel.Name = "stableTimeLabel";
- this.stableTimeLabel.Size = new System.Drawing.Size(81, 13);
- this.stableTimeLabel.TabIndex = 14;
- this.stableTimeLabel.Text = "Stable time [ms]";
- //
- // flowStableSecTextBox
- //
- this.flowStableSecTextBox.Enabled = false;
- this.flowStableSecTextBox.Location = new System.Drawing.Point(138, 219);
- this.flowStableSecTextBox.Name = "flowStableSecTextBox";
- this.flowStableSecTextBox.Size = new System.Drawing.Size(46, 20);
- this.flowStableSecTextBox.TabIndex = 17;
- //
- // flowStableSecLabel
- //
- this.flowStableSecLabel.AutoSize = true;
- this.flowStableSecLabel.Location = new System.Drawing.Point(28, 222);
- this.flowStableSecLabel.Name = "flowStableSecLabel";
- this.flowStableSecLabel.Size = new System.Drawing.Size(74, 13);
- this.flowStableSecLabel.TabIndex = 16;
- this.flowStableSecLabel.Text = "Flow stable [s]";
- //
- // RegulValveCfgCtrl
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.flowStableSecTextBox);
- this.Controls.Add(this.flowStableSecLabel);
- this.Controls.Add(this.stableTimeTextBox);
- this.Controls.Add(this.stableTimeLabel);
- this.Controls.Add(this.storedPosReuseCheckBox);
- this.Controls.Add(this.pidCoefTextBox);
- this.Controls.Add(this.pidCoefLabel);
- this.Controls.Add(this.parentNameComboBox);
- this.Controls.Add(this.dacOpenTextBox);
- this.Controls.Add(this.dacOpenLabel);
- this.Controls.Add(this.dacClosedTextBox);
- this.Controls.Add(this.dacClosedLabel);
- this.Controls.Add(this.positionTextBox);
- this.Controls.Add(this.positionLabel);
- this.Controls.Add(this.parentNameLabel);
- this.Controls.Add(this.nameTextBox);
- this.Controls.Add(this.nameLabel);
- this.Controls.Add(this.classNameLabel);
- this.Name = "RegulValveCfgCtrl";
- this.Size = new System.Drawing.Size(300, 250);
- this.Load += new System.EventHandler(this.RegulationValveCfgCtrl_Load);
- this.ResumeLayout(false);
- this.PerformLayout();
+ this.positionTextBox = new System.Windows.Forms.TextBox();
+ this.positionLabel = new System.Windows.Forms.Label();
+ this.parentNameLabel = new System.Windows.Forms.Label();
+ this.nameTextBox = new System.Windows.Forms.TextBox();
+ this.nameLabel = new System.Windows.Forms.Label();
+ this.classNameLabel = new System.Windows.Forms.Label();
+ this.dacClosedLabel = new System.Windows.Forms.Label();
+ this.dacClosedTextBox = new System.Windows.Forms.TextBox();
+ this.dacOpenTextBox = new System.Windows.Forms.TextBox();
+ this.dacOpenLabel = new System.Windows.Forms.Label();
+ this.parentNameComboBox = new System.Windows.Forms.ComboBox();
+ this.pidCoefLabel = new System.Windows.Forms.Label();
+ this.pidCoefTextBox = new System.Windows.Forms.TextBox();
+ this.storedPosReuseCheckBox = new System.Windows.Forms.CheckBox();
+ this.stableTimeTextBox = new System.Windows.Forms.TextBox();
+ this.stableTimeLabel = new System.Windows.Forms.Label();
+ this.flowStableSecTextBox = new System.Windows.Forms.TextBox();
+ this.flowStableSecLabel = new System.Windows.Forms.Label();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.setButton1 = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.ADC = new System.Windows.Forms.Label();
+ this.getButton1 = new System.Windows.Forms.Button();
+ this.pctTextBox1 = new System.Windows.Forms.TextBox();
+ this.adcTextBox1 = new System.Windows.Forms.TextBox();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.setButton2 = new System.Windows.Forms.Button();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.getButton2 = new System.Windows.Forms.Button();
+ this.pctTextBox2 = new System.Windows.Forms.TextBox();
+ this.adcTextBox2 = new System.Windows.Forms.TextBox();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.closeButton = new System.Windows.Forms.Button();
+ this.openButton = new System.Windows.Forms.Button();
+ this.groupBox1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ this.groupBox3.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // positionTextBox
+ //
+ this.positionTextBox.Enabled = false;
+ this.positionTextBox.Location = new System.Drawing.Point(138, 78);
+ this.positionTextBox.Name = "positionTextBox";
+ this.positionTextBox.Size = new System.Drawing.Size(46, 20);
+ this.positionTextBox.TabIndex = 6;
+ //
+ // positionLabel
+ //
+ this.positionLabel.AutoSize = true;
+ this.positionLabel.Location = new System.Drawing.Point(28, 81);
+ this.positionLabel.Name = "positionLabel";
+ this.positionLabel.Size = new System.Drawing.Size(18, 13);
+ this.positionLabel.TabIndex = 5;
+ this.positionLabel.Text = "ID";
+ //
+ // parentNameLabel
+ //
+ this.parentNameLabel.AutoSize = true;
+ this.parentNameLabel.Location = new System.Drawing.Point(28, 57);
+ this.parentNameLabel.Name = "parentNameLabel";
+ this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
+ this.parentNameLabel.TabIndex = 3;
+ this.parentNameLabel.Text = "Parent Name";
+ //
+ // nameTextBox
+ //
+ this.nameTextBox.Enabled = false;
+ this.nameTextBox.Location = new System.Drawing.Point(138, 30);
+ this.nameTextBox.Name = "nameTextBox";
+ this.nameTextBox.Size = new System.Drawing.Size(130, 20);
+ this.nameTextBox.TabIndex = 2;
+ //
+ // nameLabel
+ //
+ this.nameLabel.AutoSize = true;
+ this.nameLabel.Location = new System.Drawing.Point(28, 33);
+ this.nameLabel.Name = "nameLabel";
+ this.nameLabel.Size = new System.Drawing.Size(35, 13);
+ this.nameLabel.TabIndex = 1;
+ this.nameLabel.Text = "Name";
+ //
+ // classNameLabel
+ //
+ this.classNameLabel.AutoSize = true;
+ this.classNameLabel.Location = new System.Drawing.Point(135, 9);
+ this.classNameLabel.Name = "classNameLabel";
+ this.classNameLabel.Size = new System.Drawing.Size(89, 13);
+ this.classNameLabel.TabIndex = 0;
+ this.classNameLabel.Text = "ComponentName";
+ //
+ // dacClosedLabel
+ //
+ this.dacClosedLabel.AutoSize = true;
+ this.dacClosedLabel.Location = new System.Drawing.Point(28, 104);
+ this.dacClosedLabel.Name = "dacClosedLabel";
+ this.dacClosedLabel.Size = new System.Drawing.Size(93, 13);
+ this.dacClosedLabel.TabIndex = 7;
+ this.dacClosedLabel.Text = "DAC when Closed";
+ //
+ // dacClosedTextBox
+ //
+ this.dacClosedTextBox.Enabled = false;
+ this.dacClosedTextBox.Location = new System.Drawing.Point(138, 101);
+ this.dacClosedTextBox.Name = "dacClosedTextBox";
+ this.dacClosedTextBox.Size = new System.Drawing.Size(46, 20);
+ this.dacClosedTextBox.TabIndex = 8;
+ //
+ // dacOpenTextBox
+ //
+ this.dacOpenTextBox.Enabled = false;
+ this.dacOpenTextBox.Location = new System.Drawing.Point(138, 124);
+ this.dacOpenTextBox.Name = "dacOpenTextBox";
+ this.dacOpenTextBox.Size = new System.Drawing.Size(46, 20);
+ this.dacOpenTextBox.TabIndex = 10;
+ //
+ // dacOpenLabel
+ //
+ this.dacOpenLabel.AutoSize = true;
+ this.dacOpenLabel.Location = new System.Drawing.Point(28, 127);
+ this.dacOpenLabel.Name = "dacOpenLabel";
+ this.dacOpenLabel.Size = new System.Drawing.Size(87, 13);
+ this.dacOpenLabel.TabIndex = 9;
+ this.dacOpenLabel.Text = "DAC when Open";
+ //
+ // parentNameComboBox
+ //
+ this.parentNameComboBox.Enabled = false;
+ this.parentNameComboBox.FormattingEnabled = true;
+ this.parentNameComboBox.Location = new System.Drawing.Point(138, 54);
+ this.parentNameComboBox.Name = "parentNameComboBox";
+ this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
+ this.parentNameComboBox.TabIndex = 4;
+ //
+ // pidCoefLabel
+ //
+ this.pidCoefLabel.AutoSize = true;
+ this.pidCoefLabel.Location = new System.Drawing.Point(28, 150);
+ this.pidCoefLabel.Name = "pidCoefLabel";
+ this.pidCoefLabel.Size = new System.Drawing.Size(78, 13);
+ this.pidCoefLabel.TabIndex = 11;
+ this.pidCoefLabel.Text = "PID Coefficient";
+ //
+ // pidCoefTextBox
+ //
+ this.pidCoefTextBox.Enabled = false;
+ this.pidCoefTextBox.Location = new System.Drawing.Point(138, 147);
+ this.pidCoefTextBox.Name = "pidCoefTextBox";
+ this.pidCoefTextBox.Size = new System.Drawing.Size(46, 20);
+ this.pidCoefTextBox.TabIndex = 12;
+ //
+ // storedPosReuseCheckBox
+ //
+ this.storedPosReuseCheckBox.AutoSize = true;
+ this.storedPosReuseCheckBox.Enabled = false;
+ this.storedPosReuseCheckBox.Location = new System.Drawing.Point(31, 196);
+ this.storedPosReuseCheckBox.Name = "storedPosReuseCheckBox";
+ this.storedPosReuseCheckBox.Size = new System.Drawing.Size(162, 17);
+ this.storedPosReuseCheckBox.TabIndex = 13;
+ this.storedPosReuseCheckBox.Text = "Enable stored position re-use";
+ this.storedPosReuseCheckBox.UseVisualStyleBackColor = true;
+ //
+ // stableTimeTextBox
+ //
+ this.stableTimeTextBox.Enabled = false;
+ this.stableTimeTextBox.Location = new System.Drawing.Point(138, 170);
+ this.stableTimeTextBox.Name = "stableTimeTextBox";
+ this.stableTimeTextBox.Size = new System.Drawing.Size(46, 20);
+ this.stableTimeTextBox.TabIndex = 15;
+ //
+ // stableTimeLabel
+ //
+ this.stableTimeLabel.AutoSize = true;
+ this.stableTimeLabel.Location = new System.Drawing.Point(28, 173);
+ this.stableTimeLabel.Name = "stableTimeLabel";
+ this.stableTimeLabel.Size = new System.Drawing.Size(81, 13);
+ this.stableTimeLabel.TabIndex = 14;
+ this.stableTimeLabel.Text = "Stable time [ms]";
+ //
+ // flowStableSecTextBox
+ //
+ this.flowStableSecTextBox.Enabled = false;
+ this.flowStableSecTextBox.Location = new System.Drawing.Point(138, 219);
+ this.flowStableSecTextBox.Name = "flowStableSecTextBox";
+ this.flowStableSecTextBox.Size = new System.Drawing.Size(46, 20);
+ this.flowStableSecTextBox.TabIndex = 17;
+ //
+ // flowStableSecLabel
+ //
+ this.flowStableSecLabel.AutoSize = true;
+ this.flowStableSecLabel.Location = new System.Drawing.Point(28, 222);
+ this.flowStableSecLabel.Name = "flowStableSecLabel";
+ this.flowStableSecLabel.Size = new System.Drawing.Size(74, 13);
+ this.flowStableSecLabel.TabIndex = 16;
+ this.flowStableSecLabel.Text = "Flow stable [s]";
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.setButton1);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Controls.Add(this.ADC);
+ this.groupBox1.Controls.Add(this.getButton1);
+ this.groupBox1.Controls.Add(this.pctTextBox1);
+ this.groupBox1.Controls.Add(this.adcTextBox1);
+ this.groupBox1.Location = new System.Drawing.Point(17, 273);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(280, 68);
+ this.groupBox1.TabIndex = 18;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Measured value 1";
+ //
+ // setButton1
+ //
+ this.setButton1.Location = new System.Drawing.Point(229, 21);
+ this.setButton1.Name = "setButton1";
+ this.setButton1.Size = new System.Drawing.Size(38, 33);
+ this.setButton1.TabIndex = 5;
+ this.setButton1.Text = "Set";
+ this.setButton1.UseVisualStyleBackColor = true;
+ this.setButton1.Click += new System.EventHandler(this.setButton1_Click);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(209, 32);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(15, 13);
+ this.label1.TabIndex = 4;
+ this.label1.Text = "%";
+ //
+ // ADC
+ //
+ this.ADC.AutoSize = true;
+ this.ADC.Location = new System.Drawing.Point(11, 32);
+ this.ADC.Name = "ADC";
+ this.ADC.Size = new System.Drawing.Size(32, 13);
+ this.ADC.TabIndex = 3;
+ this.ADC.Text = "ADC:";
+ //
+ // getButton1
+ //
+ this.getButton1.Location = new System.Drawing.Point(101, 22);
+ this.getButton1.Name = "getButton1";
+ this.getButton1.Size = new System.Drawing.Size(38, 33);
+ this.getButton1.TabIndex = 2;
+ this.getButton1.Text = "Get";
+ this.getButton1.UseVisualStyleBackColor = true;
+ this.getButton1.Click += new System.EventHandler(this.getButton1_Click);
+ //
+ // pctTextBox1
+ //
+ this.pctTextBox1.Location = new System.Drawing.Point(160, 28);
+ this.pctTextBox1.Name = "pctTextBox1";
+ this.pctTextBox1.Size = new System.Drawing.Size(46, 20);
+ this.pctTextBox1.TabIndex = 1;
+ //
+ // adcTextBox1
+ //
+ this.adcTextBox1.Location = new System.Drawing.Point(47, 28);
+ this.adcTextBox1.Name = "adcTextBox1";
+ this.adcTextBox1.Size = new System.Drawing.Size(44, 20);
+ this.adcTextBox1.TabIndex = 0;
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.setButton2);
+ this.groupBox2.Controls.Add(this.label2);
+ this.groupBox2.Controls.Add(this.label3);
+ this.groupBox2.Controls.Add(this.getButton2);
+ this.groupBox2.Controls.Add(this.pctTextBox2);
+ this.groupBox2.Controls.Add(this.adcTextBox2);
+ this.groupBox2.Location = new System.Drawing.Point(17, 350);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(280, 68);
+ this.groupBox2.TabIndex = 19;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = "Measured value 2";
+ //
+ // setButton2
+ //
+ this.setButton2.Location = new System.Drawing.Point(229, 21);
+ this.setButton2.Name = "setButton2";
+ this.setButton2.Size = new System.Drawing.Size(38, 33);
+ this.setButton2.TabIndex = 5;
+ this.setButton2.Text = "Set";
+ this.setButton2.UseVisualStyleBackColor = true;
+ this.setButton2.Click += new System.EventHandler(this.setButton2_Click);
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(209, 32);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(15, 13);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "%";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(11, 32);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(32, 13);
+ this.label3.TabIndex = 3;
+ this.label3.Text = "ADC:";
+ //
+ // getButton2
+ //
+ this.getButton2.Location = new System.Drawing.Point(101, 22);
+ this.getButton2.Name = "getButton2";
+ this.getButton2.Size = new System.Drawing.Size(38, 33);
+ this.getButton2.TabIndex = 2;
+ this.getButton2.Text = "Get";
+ this.getButton2.UseVisualStyleBackColor = true;
+ this.getButton2.Click += new System.EventHandler(this.getButton2_Click);
+ //
+ // pctTextBox2
+ //
+ this.pctTextBox2.Location = new System.Drawing.Point(160, 28);
+ this.pctTextBox2.Name = "pctTextBox2";
+ this.pctTextBox2.Size = new System.Drawing.Size(46, 20);
+ this.pctTextBox2.TabIndex = 1;
+ //
+ // adcTextBox2
+ //
+ this.adcTextBox2.Location = new System.Drawing.Point(47, 28);
+ this.adcTextBox2.Name = "adcTextBox2";
+ this.adcTextBox2.Size = new System.Drawing.Size(44, 20);
+ this.adcTextBox2.TabIndex = 0;
+ //
+ // groupBox3
+ //
+ this.groupBox3.Controls.Add(this.closeButton);
+ this.groupBox3.Controls.Add(this.openButton);
+ this.groupBox3.Location = new System.Drawing.Point(17, 427);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(280, 60);
+ this.groupBox3.TabIndex = 20;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Text = "Regulation valve";
+ //
+ // closeButton
+ //
+ this.closeButton.Location = new System.Drawing.Point(14, 19);
+ this.closeButton.Name = "closeButton";
+ this.closeButton.Size = new System.Drawing.Size(107, 28);
+ this.closeButton.TabIndex = 1;
+ this.closeButton.Text = "Close";
+ this.closeButton.UseVisualStyleBackColor = true;
+ this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
+ //
+ // openButton
+ //
+ this.openButton.Location = new System.Drawing.Point(160, 19);
+ this.openButton.Name = "openButton";
+ this.openButton.Size = new System.Drawing.Size(107, 28);
+ this.openButton.TabIndex = 0;
+ this.openButton.Text = "Open";
+ this.openButton.UseVisualStyleBackColor = true;
+ this.openButton.Click += new System.EventHandler(this.openButton_Click);
+ //
+ // RegulValveCfgCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.groupBox3);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
+ this.Controls.Add(this.flowStableSecTextBox);
+ this.Controls.Add(this.flowStableSecLabel);
+ this.Controls.Add(this.stableTimeTextBox);
+ this.Controls.Add(this.stableTimeLabel);
+ this.Controls.Add(this.storedPosReuseCheckBox);
+ this.Controls.Add(this.pidCoefTextBox);
+ this.Controls.Add(this.pidCoefLabel);
+ this.Controls.Add(this.parentNameComboBox);
+ this.Controls.Add(this.dacOpenTextBox);
+ this.Controls.Add(this.dacOpenLabel);
+ this.Controls.Add(this.dacClosedTextBox);
+ this.Controls.Add(this.dacClosedLabel);
+ this.Controls.Add(this.positionTextBox);
+ this.Controls.Add(this.positionLabel);
+ this.Controls.Add(this.parentNameLabel);
+ this.Controls.Add(this.nameTextBox);
+ this.Controls.Add(this.nameLabel);
+ this.Controls.Add(this.classNameLabel);
+ this.Name = "RegulValveCfgCtrl";
+ this.Size = new System.Drawing.Size(300, 500);
+ this.Load += new System.EventHandler(this.RegulationValveCfgCtrl_Load);
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.groupBox2.ResumeLayout(false);
+ this.groupBox2.PerformLayout();
+ this.groupBox3.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -255,5 +448,22 @@
private System.Windows.Forms.Label stableTimeLabel;
private System.Windows.Forms.TextBox flowStableSecTextBox;
private System.Windows.Forms.Label flowStableSecLabel;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.Button setButton1;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label ADC;
+ private System.Windows.Forms.Button getButton1;
+ private System.Windows.Forms.TextBox pctTextBox1;
+ private System.Windows.Forms.TextBox adcTextBox1;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.Button setButton2;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Button getButton2;
+ private System.Windows.Forms.TextBox pctTextBox2;
+ private System.Windows.Forms.TextBox adcTextBox2;
+ private System.Windows.Forms.GroupBox groupBox3;
+ private System.Windows.Forms.Button closeButton;
+ private System.Windows.Forms.Button openButton;
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs
index 34c868369..3660cd42c 100644
--- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs
@@ -10,6 +10,9 @@ namespace TBF.BenchControl.Elde.RegulValve
static readonly ILog log = LogManager.GetLogger(typeof(RegulValveCfgCtrl));
ComponentParametersDlg parent;
+
+ public bool ShowMore { get { return true; } }
+
RegulValveCfg config;
public IComponentCfg Config
{
@@ -42,7 +45,21 @@ namespace TBF.BenchControl.Elde.RegulValve
}
}
+ if (config != null)
+ {
+ adc1 = config.DacValueClosed;
+ pct1 = 0;
+ adc2 = config.DacValueOpen;
+ pct2 = 100;
+ }
+
Redraw();
+ StartResponseHandler();
+ }
+
+ public void Closing()
+ {
+ StopResponseHandler();
}
void Redraw()
@@ -59,7 +76,12 @@ namespace TBF.BenchControl.Elde.RegulValve
stableTimeTextBox.Text = config.StableTimeMs.ToString();
storedPosReuseCheckBox.Checked = config.StoredPositionReuse;
flowStableSecTextBox.Text = config.FlowStableSec.ToString();
- }
+
+ adcTextBox1.Text = adc1.ToString();
+ adcTextBox2.Text = adc2.ToString();
+ pctTextBox1.Text = pct1.ToString();
+ pctTextBox2.Text = pct2.ToString();
+ }
public void Unlock()
{
@@ -74,63 +96,219 @@ namespace TBF.BenchControl.Elde.RegulValve
flowStableSecTextBox.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 > 5)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Position' should be between 1 and 5";
}
if (!int.TryParse(dacClosedTextBox.Text, out dummy) || dummy < 0 || dummy > 1023)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'DAC when Closed' should be between 0 and 1023";
}
if (!int.TryParse(dacOpenTextBox.Text, out dummy) || dummy < 0 || dummy > 1023)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'DAC when Open' should be between 0 and 1023";
}
if (!int.TryParse(pidCoefTextBox.Text, out dummy) || dummy < 0 || dummy > 100)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'PID Coefficient' should be between 0 and 100";
}
if (!int.TryParse(stableTimeTextBox.Text, out dummy) || dummy < 200 || dummy > 1500 || (dummy % 50) != 0)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Stable time' should be between 200 and 1500 ms in 50 ms steps";
}
if (!int.TryParse(flowStableSecTextBox.Text, out dummy) || dummy < 0 || dummy > 60)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Flow stable' should be between 0 and 60 sec";
}
return flags;
}
- public void UpdateCfg()
+ public CfgUpdateFlags UpdateCfg()
{
- if (config == null) return; /// Control was not loaded, settings were not changed
+ CfgUpdateFlags flags = CfgUpdateFlags.None;
- config.Name = nameTextBox.Text;
- config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
- config.Idx1 = int.Parse(positionTextBox.Text);
- config.DacValueClosed = int.Parse(dacClosedTextBox.Text);
- config.DacValueOpen = int.Parse(dacOpenTextBox.Text);
- config.PidCoef = int.Parse(pidCoefTextBox.Text);
- config.StableTimeMs = int.Parse(stableTimeTextBox.Text);
- config.StoredPositionReuse = storedPosReuseCheckBox.Checked;
- config.FlowStableSec = int.Parse(flowStableSecTextBox.Text);
+ if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
+ ///
+ if (!config.Name.Equals(nameTextBox.Text))
+ {
+ config.Name = nameTextBox.Text;
+ flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
+ }
+
+ string parentname = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
+ if (!config.ParentName.Equals(parentname))
+ {
+ config.ParentName = parentname;
+ flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
+ }
+
+ int tmp = int.Parse(positionTextBox.Text);
+ if (config.Idx1 != tmp)
+ {
+ config.Idx1 = tmp;
+ flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
+ }
+
+ tmp = int.Parse(dacClosedTextBox.Text);
+ if (config.DacValueClosed != tmp)
+ {
+ config.DacValueClosed = tmp;
+ flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
+ }
+
+ tmp = int.Parse(dacOpenTextBox.Text);
+ if (config.DacValueOpen != tmp)
+ {
+ config.DacValueOpen = tmp;
+ flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
+ }
+
+ tmp = int.Parse(pidCoefTextBox.Text);
+ if (config.PidCoef != tmp)
+ {
+ config.PidCoef = tmp;
+ flags |= CfgUpdateFlags.AnyChange;
+ }
+
+ tmp = int.Parse(stableTimeTextBox.Text);
+ if (config.StableTimeMs != tmp)
+ {
+ config.StableTimeMs = tmp;
+ flags |= CfgUpdateFlags.AnyChange;
+ }
+
+ bool btmp = storedPosReuseCheckBox.Checked;
+ if (config.StoredPositionReuse != btmp)
+ {
+ config.StoredPositionReuse = btmp;
+ flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
+ }
+
+ tmp = int.Parse(flowStableSecTextBox.Text);
+ if (config.FlowStableSec != tmp)
+ {
+ config.FlowStableSec = tmp;
+ flags |= CfgUpdateFlags.AnyChange;
+ }
+
+ if ((flags & CfgUpdateFlags.AnyChange) != 0)
+ {
+ RegulValve.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
+ }
+
+ return flags;
}
+
+ int adc1;
+ int pct1;
+
+ int adc2;
+ int pct2;
+
+ private void openButton_Click(object sender, EventArgs e)
+ {
+ RegulValve.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.RVOpenStep, config));
+ }
+
+ private void closeButton_Click(object sender, EventArgs e)
+ {
+ RegulValve.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.RVCloseStep, config));
+ }
+
+ //
+ private void getButton1_Click(object sender, EventArgs e)
+ {
+ RegulValve.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.GetRVAdc1, config));
+ }
+
+ private void getButton2_Click(object sender, EventArgs e)
+ {
+ RegulValve.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.GetRVAdc2, config));
+ }
+
+ private void setButton1_Click(object sender, EventArgs e)
+ {
+ setButton2_Click(sender, e); /// Both Save buttons have the same effect
+ }
+
+ private void setButton2_Click(object sender, EventArgs e)
+ {
+ int tmpPct1;
+ int tmpPct2;
+ if ((int.TryParse(pctTextBox1.Text, out tmpPct1) && (tmpPct1 >= 0) && (tmpPct1 <= 100)) &&
+ (int.TryParse(pctTextBox2.Text, out tmpPct2) && (tmpPct2 >= 0) && (tmpPct2 <= 100)))
+ {
+ pct1 = tmpPct1;
+ pct2 = tmpPct2;
+ UpdateValveOpenClose();
+ }
+ }
+
+ void UpdateValveOpenClose()
+ {
+ if ((adc1 == adc2) || (pct1 == pct2)) return;
+
+ double factor = (float)(adc2 - adc1) / (float)(pct2 - pct1);
+ int dacClosed = (int)((float)(0 - pct1) * factor + (float)adc1 + 0.5f);
+ int dacOpen = (int)((float)(100 - pct1) * factor + (float)adc1 + 0.5f);
+
+ if ((dacClosed >= 0) && (dacOpen >= 0))
+ {
+ dacClosedTextBox.Text = dacClosed.ToString();
+ dacOpenTextBox.Text = dacOpen.ToString();
+ }
+ }
+
+ #region Configuration Change Handling
+
+ public static void OnCmdResponse(object sender, CmdResponseArgs args)
+ {
+ if (CmdResponseHandler == null) return;
+ try { CmdResponseHandler(sender, args); }
+ catch (Exception e) { log.Error("CmdResponseHandler(...) failed", e); }
+ }
+
+ public static event EventHandler CmdResponseHandler;
+
+ public void StartResponseHandler()
+ {
+ CmdResponseHandler += delegate(object sender, CmdResponseArgs args)
+ {
+ if (args.Command == CfgChangeCmd.GetRVAdc1)
+ {
+ adc1 = args.Response;
+ adcTextBox1.Text = adc1.ToString();
+ }
+ else if (args.Command == CfgChangeCmd.GetRVAdc2)
+ {
+ adc2 = args.Response;
+ adcTextBox2.Text = adc2.ToString();
+ }
+ };
+ }
+
+ public void StopResponseHandler()
+ {
+ CmdResponseHandler = null;
+ }
+
+ #endregion Configuration Change Handling
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterCfgCtrl.cs
index 912f4379b..fae5edb01 100644
--- a/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterCfgCtrl.cs
@@ -11,6 +11,9 @@ namespace TBF.BenchControl.Elde.TempMeter
static readonly ILog log = LogManager.GetLogger(typeof(TempMeterCfgCtrl));
ComponentParametersDlg parent;
+
+ public bool ShowMore { get { return false; } }
+
TempMeterCfg config;
public IComponentCfg Config
{
@@ -46,6 +49,10 @@ namespace TBF.BenchControl.Elde.TempMeter
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -73,59 +80,61 @@ namespace TBF.BenchControl.Elde.TempMeter
a5TextBox.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 < 0 || dummy > 7)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Position' should be between 0 and 7";
}
float fdummy;
if (!Utils.TryParseEFloat(a1TextBox.Text, out fdummy))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'A1' is not valid";
}
if (!Utils.TryParseEFloat(a2TextBox.Text, out fdummy))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'A2' is not valid";
}
if (!Utils.TryParseEFloat(a3TextBox.Text, out fdummy))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'A3' is not valid";
}
if (!Utils.TryParseEFloat(a4TextBox.Text, out fdummy))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'A4' is not valid";
}
if (!Utils.TryParseEFloat(a5TextBox.Text, out fdummy))
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'A5' is not valid";
}
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;
@@ -135,6 +144,8 @@ namespace TBF.BenchControl.Elde.TempMeter
Utils.TryParseEFloat(a3TextBox.Text, out config.A3) &&
Utils.TryParseEFloat(a4TextBox.Text, out config.A4) &&
Utils.TryParseEFloat(a5TextBox.Text, out config.A5);
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/Elde/Valve/ValveCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/Valve/ValveCfgCtrl.cs
index 1c9971b0e..b259037cc 100644
--- a/TestBenchFramework/BenchControl/Elde/Valve/ValveCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Elde/Valve/ValveCfgCtrl.cs
@@ -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;
diff --git a/TestBenchFramework/BenchControl/Events.cs b/TestBenchFramework/BenchControl/Events.cs
index bf15addff..b8de567ca 100644
--- a/TestBenchFramework/BenchControl/Events.cs
+++ b/TestBenchFramework/BenchControl/Events.cs
@@ -14,11 +14,25 @@
///
/// Flags returned by each device configuration control Verify(...) function.
///
- public enum CfgVerifyFlags
+ public enum CfgUpdateFlags
{
None = 0,
Error = 0x1, /// Some settings in the user control are invalid and cannot be set
Warning = 0x02, /// Some settings in the user control are suspicious, can be set after user confirmation
+ RestartRqrd = 0x04, /// TBF program restart is required to apply all changed parameters
+ AnyChange = 0x08, /// At least one parameter have changed
+ }
+
+ public enum CfgChangeCmd
+ {
+ None,
+ CfgChange, /// COnfiguation change
+ ValveOpen, /// Open a valve
+ ValveClose, /// Close a valve
+ RVOpenStep, /// Open a regulation valve
+ RVCloseStep, /// Close a regulation valve
+ GetRVAdc1, /// Get regulation valve ADC feedback value #1
+ GetRVAdc2, /// Get regulation valve ADC feedback value #2
}
public enum ValveCategory
diff --git a/TestBenchFramework/BenchControl/Generic/IComponent.cs b/TestBenchFramework/BenchControl/Generic/IComponent.cs
index a7acc62bd..ca74a6d62 100644
--- a/TestBenchFramework/BenchControl/Generic/IComponent.cs
+++ b/TestBenchFramework/BenchControl/Generic/IComponent.cs
@@ -14,5 +14,9 @@ namespace TBF.BenchControl.Generic
Entities.LogLevel LogLevel { get; }
IComponentCfg Cfg { get; }
+
+ void StartChangeHandler();
+
+ void StopChangeHandler();
}
}
diff --git a/TestBenchFramework/BenchControl/Generic/IComponentCfgCtrl.cs b/TestBenchFramework/BenchControl/Generic/IComponentCfgCtrl.cs
index 69db0ee14..7c4170e8e 100644
--- a/TestBenchFramework/BenchControl/Generic/IComponentCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Generic/IComponentCfgCtrl.cs
@@ -9,20 +9,31 @@ namespace TBF.BenchControl.Generic
IComponentCfg Config { get; set; }
///
- /// Verify current user controls for validity.
- /// Called when user wants to close/save the configuration.
+ /// When true, More/Less button will be shown and processed
///
- /// See VerifyFlags
- CfgVerifyFlags VerifyCfg(ref string message);
+ bool ShowMore { get; }
///
- /// Save settings to the configuration class.
+ /// Unlock controls.
///
void Unlock();
///
- /// Save settings to the configuration class.
+ /// Verify current user controls for validity.
+ /// Called when user wants to close/save the configuration.
///
- void UpdateCfg();
+ /// See VerifyFlags
+ CfgUpdateFlags VerifyCfg(ref string message);
+
+ ///
+ /// Save form parameters to the configuration class.
+ ///
+ CfgUpdateFlags UpdateCfg();
+
+ ///
+ /// Called when the dialog with component configuration control is closing.
+ /// In this function CmdResponse handelrs (if any) should be closed, etc.
+ ///
+ void Closing();
}
}
diff --git a/TestBenchFramework/BenchControl/Greco/AmbientCfgCtrl.cs b/TestBenchFramework/BenchControl/Greco/AmbientCfgCtrl.cs
index 23399502e..380a826e5 100644
--- a/TestBenchFramework/BenchControl/Greco/AmbientCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/Greco/AmbientCfgCtrl.cs
@@ -1,14 +1,18 @@
using System;
using System.Windows.Forms;
using System.IO.Ports;
+using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Greco
{
public partial class AmbientCfgCtrl : UserControl, IComponentCfgCtrl
{
- AmbientCfg config;
+ static readonly ILog log = LogManager.GetLogger(typeof(AmbientCfgCtrl));
+ public bool ShowMore { get { return false; } }
+
+ AmbientCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -89,6 +93,10 @@ namespace TBF.BenchControl.Greco
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -114,9 +122,11 @@ namespace TBF.BenchControl.Greco
handshakeComboBox.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.ComPortNr = int.Parse(comPortNrTextBox.Text);
@@ -125,28 +135,30 @@ namespace TBF.BenchControl.Greco
config.DataBits = int.Parse(dataBitsTextBox.Text);
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
+
+ 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 (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Serial Port Number' is not valid";
}
if (!int.TryParse(baudRateTextBox.Text, out dummy) || dummy < 150 || dummy > 115200)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Baud Rate' is not valid";
}
if (!int.TryParse(dataBitsTextBox.Text, out dummy) || dummy < 7 || dummy > 8)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Data Bits' is not valid";
}
diff --git a/TestBenchFramework/BenchControl/MettlerToledo/BalanceCfgCtrl.cs b/TestBenchFramework/BenchControl/MettlerToledo/BalanceCfgCtrl.cs
index 6269f2097..e9a20e35e 100644
--- a/TestBenchFramework/BenchControl/MettlerToledo/BalanceCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/MettlerToledo/BalanceCfgCtrl.cs
@@ -2,14 +2,18 @@
using System.Globalization;
using System.Windows.Forms;
using System.IO.Ports;
+using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.MettlerToledo
{
public partial class BalanceCfgCtrl : UserControl, IComponentCfgCtrl
{
- BalanceCfg config;
+ static readonly ILog log = LogManager.GetLogger(typeof(BalanceCfgCtrl));
+ public bool ShowMore { get { return false; } }
+
+ BalanceCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -90,6 +94,10 @@ namespace TBF.BenchControl.MettlerToledo
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -121,49 +129,51 @@ namespace TBF.BenchControl.MettlerToledo
emptyTimeTextBox.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 (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Serial Port Number' is not valid";
}
if (!int.TryParse(baudRateTextBox.Text, out dummy) || dummy < 150 || dummy > 115200)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Baud Rate' is not valid";
}
if (!int.TryParse(dataBitsTextBox.Text, out dummy) || dummy < 7 || dummy > 8)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Data Bits' is not valid";
}
float mass;
if (!Utils.TryParseUFloat(capacityTextBox.Text, out mass) || mass <= 0)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank Capacity' is not valid";
}
if (!Utils.TryParseUFloat(emptyTextBox.Text, out mass) || mass <= 0)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank Empty' is not valid";
}
if (!int.TryParse(emptyTimeTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
{
- flags |= CfgVerifyFlags.Error;
+ flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank Empty Time' should be between 1 and 999 sec";
}
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.ComPortNr = int.Parse(comPortNrTextBox.Text);
@@ -175,6 +185,8 @@ namespace TBF.BenchControl.MettlerToledo
config.Capacity = Utils.ParseUFloat(capacityTextBox.Text);
config.Empty = Utils.ParseUFloat(emptyTextBox.Text);
config.EmptyTimeSec = int.Parse(emptyTimeTextBox.Text);
- }
+
+ return flags;
+ }
}
}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.cs
index 13d7d66d5..426285f8a 100644
--- a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
{
static readonly ILog log = LogManager.GetLogger(typeof(PrinterCfgCtrl));
- PrinterCfg config;
+ public bool ShowMore { get { return false; } }
+ PrinterCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterCfgCtrl.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterCfgCtrl.cs
index 1169bf8b6..d9490aa22 100644
--- a/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
{
static readonly ILog log = LogManager.GetLogger(typeof(PrinterCfgCtrl));
- PrinterCfg config;
+ public bool ShowMore { get { return false; } }
+ PrinterCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.cs b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.cs
index ac2b59074..a861739ea 100644
--- a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.ResultsWriters.Basic
{
static readonly ILog log = LogManager.GetLogger(typeof(WriterCfgCtrl));
- WriterCfg config;
+ public bool ShowMore { get { return false; } }
+ WriterCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.ResultsWriters.Basic
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.ResultsWriters.Basic
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/StateMachine.cs b/TestBenchFramework/BenchControl/StateMachine.cs
index 171f4d5c7..816edd4b8 100644
--- a/TestBenchFramework/BenchControl/StateMachine.cs
+++ b/TestBenchFramework/BenchControl/StateMachine.cs
@@ -226,6 +226,8 @@ namespace TBF.BenchControl
Elde.Valve.Valve eldeValve = (cmpnt as Elde.Valve.Valve);
if ((eldeValve != null) && eldeValve.Inverted) valvesToInvert |= eldeValve.Mask;
+
+ cmpnt.StartChangeHandler(); /// Start handling parameter change events
}
/// Create an array with tank capacities
diff --git a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionCfgCtrl.cs b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionCfgCtrl.cs
index 311a39b34..51c1971d7 100644
--- a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
{
static readonly ILog log = LogManager.GetLogger(typeof(RoiDetectionCfgCtrl));
- RoiDetectionCfg config;
+ public bool ShowMore { get { return false; } }
+ RoiDetectionCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodCfgCtrl.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodCfgCtrl.cs
index b75f0a6ed..7dc738eb5 100644
--- a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
{
static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl));
- TestMethodCfg config;
+ public bool ShowMore { get { return false; } }
+ TestMethodCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodCfgCtrl.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodCfgCtrl.cs
index eeb70fc60..c87d14c57 100644
--- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
{
static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl));
- TestMethodCfg config;
+ public bool ShowMore { get { return false; } }
+ TestMethodCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodCfgCtrl.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodCfgCtrl.cs
index 0c8b92ec0..9c9a6cd72 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
{
static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl));
- TestMethodCfg config;
+ public bool ShowMore { get { return false; } }
+ TestMethodCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodCfgCtrl.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodCfgCtrl.cs
index 99f4fd0f8..103e5f74d 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
{
static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl));
- TestMethodCfg config;
+ public bool ShowMore { get { return false; } }
+ TestMethodCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfgCtrl.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfgCtrl.cs
index 152f606c5..ccd920004 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
{
static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl));
- TestMethodCfg config;
+ public bool ShowMore { get { return false; } }
+ TestMethodCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodCfgCtrl.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodCfgCtrl.cs
index 3ec7ac71e..a946b5de5 100644
--- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodCfgCtrl.cs
@@ -9,8 +9,9 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
{
static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl));
- TestMethodCfg config;
+ public bool ShowMore { get { return false; } }
+ TestMethodCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -31,6 +32,10 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -43,16 +48,21 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/BenchControl/WaterMeter/WaterMeterCfgCtrl.cs b/TestBenchFramework/BenchControl/WaterMeter/WaterMeterCfgCtrl.cs
index fbc48564f..b69e79531 100644
--- a/TestBenchFramework/BenchControl/WaterMeter/WaterMeterCfgCtrl.cs
+++ b/TestBenchFramework/BenchControl/WaterMeter/WaterMeterCfgCtrl.cs
@@ -10,8 +10,9 @@ namespace TBF.BenchControl.WaterMeter
{
static readonly ILog log = LogManager.GetLogger(typeof(WaterMeterCfgCtrl));
- WaterMeterCfg config;
+ public bool ShowMore { get { return false; } }
+ WaterMeterCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
@@ -33,6 +34,10 @@ namespace TBF.BenchControl.WaterMeter
Redraw();
}
+ public void Closing()
+ {
+ }
+
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -45,16 +50,21 @@ namespace TBF.BenchControl.WaterMeter
nameTextBox.Enabled = true;
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- CfgVerifyFlags flags = CfgVerifyFlags.None;
+ CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
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;
+
+ return flags;
}
}
}
diff --git a/TestBenchFramework/ComponentParametersDlg.cs b/TestBenchFramework/ComponentParametersDlg.cs
index f8513c720..00e374cf5 100644
--- a/TestBenchFramework/ComponentParametersDlg.cs
+++ b/TestBenchFramework/ComponentParametersDlg.cs
@@ -21,6 +21,8 @@ namespace TBF
}
}
+ public CfgUpdateFlags Flags;
+
///
/// List of components (=component configuration instances)
///
@@ -30,12 +32,15 @@ namespace TBF
{
InitializeComponent();
+ Flags = CfgUpdateFlags.None;
+
/// SharedDlgButtons configuration
sharedButtons.RequiredGroupMembership = Grp.GID.Metrologists;
sharedButtons.OptionalButtons = SharedButtons.Buttons.None;
sharedButtons.Unlocked += Unlock;
sharedButtons.OKClicked += okButton_Click;
sharedButtons.CancelClicked += cancelButton_Click;
+ sharedButtons.MoreClicked += moreButton_Click;
}
private void ComponentCfgForm_Load(object sender, EventArgs e)
@@ -46,6 +51,11 @@ namespace TBF
{
splitContainer.Panel1.Controls.Add((UserControl)ComponentCfgCtrl);
}
+
+ if ((ComponentCfgCtrl != null) && ComponentCfgCtrl.ShowMore)
+ {
+ sharedButtons.OptionalButtons = SharedButtons.Buttons.More;
+ }
}
private void Unlock(object sender, EventArgs e)
@@ -53,25 +63,36 @@ namespace TBF
ComponentCfgCtrl.Unlock();
}
- public CfgVerifyFlags VerifyCfg(ref string message)
+ public CfgUpdateFlags VerifyCfg(ref string message)
{
- if (ComponentCfgCtrl == null) return CfgVerifyFlags.None; /// Nothing to verify -> OK
+ if (ComponentCfgCtrl == null) return CfgUpdateFlags.None; /// Nothing to verify -> OK
return ComponentCfgCtrl.VerifyCfg(ref message);
}
private void okButton_Click(object sender, EventArgs e)
{
string message = string.Empty;
- CfgVerifyFlags flags = VerifyCfg(ref message);
- if ((flags & CfgVerifyFlags.Error) == CfgVerifyFlags.Error)
+ CfgUpdateFlags flags = VerifyCfg(ref message);
+ if ((flags & CfgUpdateFlags.Error) == CfgUpdateFlags.Error)
{
MessageBox.Show(Strings.Please_change_the_following_settings + message,
Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
- if (ComponentCfgCtrl != null) ComponentCfgCtrl.UpdateCfg();
+ if (ComponentCfgCtrl != null)
+ {
+ flags = ComponentCfgCtrl.UpdateCfg();
+ if ((flags & CfgUpdateFlags.RestartRqrd) == CfgUpdateFlags.RestartRqrd)
+ {
+ MessageBox.Show(Strings.Program_restart_is_required_to_apply_some_settings,
+ Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+ ComponentCfgCtrl.Closing();
+ }
+
+ Flags = flags;
DialogResult = DialogResult.OK;
Close();
return;
@@ -79,9 +100,25 @@ namespace TBF
private void cancelButton_Click(object sender, EventArgs e)
{
+ if (ComponentCfgCtrl != null) ComponentCfgCtrl.Closing();
DialogResult = DialogResult.Cancel;
Close();
return;
}
+
+ private void moreButton_Click(object sender, EventArgs e)
+ {
+ ComponentCfgCtrl.Unlock();
+
+ if (sharedButtons.MoreActive)
+ {
+ Height = Height + 250;
+ }
+ else
+ {
+ Height = Height - 250;
+ }
+ return;
+ }
}
}
diff --git a/TestBenchFramework/ComponentsManagerDlg.cs b/TestBenchFramework/ComponentsManagerDlg.cs
index 8fd822611..163cff671 100644
--- a/TestBenchFramework/ComponentsManagerDlg.cs
+++ b/TestBenchFramework/ComponentsManagerDlg.cs
@@ -26,6 +26,8 @@ namespace TBF
SelectComponentClassDlg selectComponentTypeDlg; /// Constructed once, the selection is kept between dialog usages
+ CfgUpdateFlags flags; /// Or-ed from particular Flags from ComponentParametersDlg
+
///
/// ListViewEx columns
///
@@ -52,6 +54,8 @@ namespace TBF
InitializeComponent();
+ flags = CfgUpdateFlags.None;
+
selectComponentTypeDlg = new SelectComponentClassDlg();
/// SharedDlgButtons configuration
@@ -183,20 +187,23 @@ namespace TBF
/// OK
private void okButton_Click(object sender, EventArgs e)
{
- foreach (var cmpnt in toBeDeletedEntities)
+ if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
{
- FluentCommon.DeleteFromDb(session, cmpnt);
- }
- foreach (var cmpnt in cmpntEntities)
- {
- FluentCommon.SaveToDb(session, cmpnt);
- }
+ foreach (var cmpnt in toBeDeletedEntities)
+ {
+ FluentCommon.DeleteFromDb(session, cmpnt);
+ }
+ foreach (var cmpnt in cmpntEntities)
+ {
+ FluentCommon.SaveToDb(session, cmpnt);
+ }
- Program.LocalSettings.ComponentsDlgLeft = Location.X;
- Program.LocalSettings.ComponentsDlgTop = Location.Y;
- Program.LocalSettings.ComponentsDlgWidth = Size.Width;
- Program.LocalSettings.ComponentsDlgHeight = Size.Height;
- Program.LocalSettings.Save();
+ Program.LocalSettings.ComponentsDlgLeft = Location.X;
+ Program.LocalSettings.ComponentsDlgTop = Location.Y;
+ Program.LocalSettings.ComponentsDlgWidth = Size.Width;
+ Program.LocalSettings.ComponentsDlgHeight = Size.Height;
+ Program.LocalSettings.Save();
+ }
DialogResult = DialogResult.OK;
Close();
@@ -212,6 +219,15 @@ namespace TBF
Program.LocalSettings.ComponentsDlgHeight = Size.Height;
Program.LocalSettings.Save();
+ if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
+ {
+ DialogResult dr = MessageBox.Show(Strings.Changes_will_be_lost_Do_you_want_to_proceed,
+ Strings.Warning,
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Question);
+ if (dr != DialogResult.Yes) return;
+ }
+
DialogResult = DialogResult.Cancel;
Close();
return;
@@ -277,6 +293,8 @@ namespace TBF
DialogResult dr = cfgForm.ShowDialog();
if (dr != DialogResult.OK) return;
+ flags |= cfgForm.Flags;
+
sharedButtons.UnlockButtons(); /// Unlock this dialog buttons as changes were enabled
unlocked = true; /// in the ComponentParametersDlg.
diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs
index 70363f534..0a40c6df4 100644
--- a/TestBenchFramework/Resources/Strings.Designer.cs
+++ b/TestBenchFramework/Resources/Strings.Designer.cs
@@ -231,6 +231,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Changes will be lost. Do you want to proceed?.
+ ///
+ internal static string Changes_will_be_lost_Do_you_want_to_proceed {
+ get {
+ return ResourceManager.GetString("Changes_will_be_lost_Do_you_want_to_proceed", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Clear results.
///
@@ -780,6 +789,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Less.
+ ///
+ internal static string LessBtnText {
+ get {
+ return ResourceManager.GetString("LessBtnText", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Loading the procedure.
///
@@ -933,6 +951,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to More.
+ ///
+ internal static string MoreBtnText {
+ get {
+ return ResourceManager.GetString("MoreBtnText", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Name.
///
@@ -1284,6 +1311,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Program restart is required to apply some settings.
+ ///
+ internal static string Program_restart_is_required_to_apply_some_settings {
+ get {
+ return ResourceManager.GetString("Program_restart_is_required_to_apply_some_settings", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Progress.
///
diff --git a/TestBenchFramework/Resources/Strings.de.resx b/TestBenchFramework/Resources/Strings.de.resx
index ce19350e2..d9b4e455b 100644
--- a/TestBenchFramework/Resources/Strings.de.resx
+++ b/TestBenchFramework/Resources/Strings.de.resx
@@ -774,4 +774,10 @@
Stab.Zeit [s]
+
+ weniger
+
+
+ mehr
+
\ No newline at end of file
diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx
index 3956d4f51..67e8295df 100644
--- a/TestBenchFramework/Resources/Strings.resx
+++ b/TestBenchFramework/Resources/Strings.resx
@@ -862,4 +862,16 @@
Stab.time [s]
+
+ Less
+
+
+ More
+
+
+ Program restart is required to apply some settings
+
+
+ Changes will be lost. Do you want to proceed?
+
\ No newline at end of file
diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj
index cf6cb0b6c..2d9bac31e 100644
--- a/TestBenchFramework/TBF.csproj
+++ b/TestBenchFramework/TBF.csproj
@@ -159,6 +159,8 @@
+
+
diff --git a/TestBenchFramework/UiControls/SharedButtons.Designer.cs b/TestBenchFramework/UiControls/SharedButtons.Designer.cs
index c2f28abed..f8a7dbdf0 100644
--- a/TestBenchFramework/UiControls/SharedButtons.Designer.cs
+++ b/TestBenchFramework/UiControls/SharedButtons.Designer.cs
@@ -40,6 +40,7 @@
this.newTabButton = new System.Windows.Forms.Button();
this.renameTabButton = new System.Windows.Forms.Button();
this.removeTabButton = new System.Windows.Forms.Button();
+ this.moreButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// removeButton
@@ -174,10 +175,22 @@
this.removeTabButton.UseVisualStyleBackColor = true;
this.removeTabButton.Click += new System.EventHandler(this.removeTabButton_Click);
//
+ // moreButton
+ //
+ this.moreButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.moreButton.Location = new System.Drawing.Point(10, 523);
+ this.moreButton.Name = "moreButton";
+ this.moreButton.Size = new System.Drawing.Size(80, 40);
+ this.moreButton.TabIndex = 12;
+ this.moreButton.Text = "More";
+ this.moreButton.UseVisualStyleBackColor = true;
+ this.moreButton.Click += new System.EventHandler(this.moreButton_Click);
+ //
// SharedButtons
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.moreButton);
this.Controls.Add(this.removeTabButton);
this.Controls.Add(this.renameTabButton);
this.Controls.Add(this.newTabButton);
@@ -211,5 +224,6 @@
private System.Windows.Forms.Button newTabButton;
private System.Windows.Forms.Button renameTabButton;
private System.Windows.Forms.Button removeTabButton;
+ private System.Windows.Forms.Button moreButton;
}
}
diff --git a/TestBenchFramework/UiControls/SharedButtons.cs b/TestBenchFramework/UiControls/SharedButtons.cs
index b49280ad4..e88904987 100644
--- a/TestBenchFramework/UiControls/SharedButtons.cs
+++ b/TestBenchFramework/UiControls/SharedButtons.cs
@@ -24,7 +24,8 @@ namespace TBF.UiControls
NewTab = 256, /// optional
RenameTab = 512, /// optional
RemoveTab = 1024, /// optional
- }
+ More = 2048, /// optional
+ }
///
/// Optional buttons are Add, Remove, Up, Down, Edit and Copy.
@@ -39,6 +40,8 @@ namespace TBF.UiControls
}
LockState lockState;
+ public bool MoreActive;
+
///
/// Used by controls to indicate which item is selected
/// and to appropriately update Remove, Up and Down Buttons.
@@ -63,6 +66,7 @@ namespace TBF.UiControls
{
originalUser = Entities.User.CurrentUser;
lockState = LockState.Locked;
+ MoreActive = false;
OptionalButtons = Buttons.None;
RequiredGroupMembership = Grp.GID.None;
InitializeComponent();
@@ -87,6 +91,7 @@ namespace TBF.UiControls
newTabButton.Text = Strings.NewTabBtnText;
renameTabButton.Text = Strings.RenameTabBtnText;
removeTabButton.Text = Strings.RemoveTabBtnText;
+ moreButton.Text = Strings.MoreBtnText;
cancelButton.Hide();
addButton.Hide();
@@ -98,6 +103,7 @@ namespace TBF.UiControls
newTabButton.Hide();
renameTabButton.Hide();
removeTabButton.Hide();
+ moreButton.Hide();
/// Reposition 'Edit' and 'Copy" buttons in case both 'Up' and 'Down' are hidden
if (((OptionalButtons & Buttons.Up) == 0) &&
@@ -116,6 +122,18 @@ namespace TBF.UiControls
renameTabButton.Top = copyButton.Top + 15;
}
+ if ((OptionalButtons & Buttons.Add) == 0 &&
+ (OptionalButtons & Buttons.Remove) == 0 &&
+ (OptionalButtons & Buttons.Up) == 0 &&
+ (OptionalButtons & Buttons.Down) == 0 &&
+ (OptionalButtons & Buttons.Edit) == 0 &&
+ (OptionalButtons & Buttons.Copy) == 0 &&
+ (OptionalButtons & Buttons.NewTab) == 0 &&
+ (OptionalButtons & Buttons.RenameTab) == 0 &&
+ (OptionalButtons & Buttons.RemoveTab) == 0)
+ {
+ moreButton.Top = addButton.Top + 70;
+ }
#if DEBUG
//unlockBtn_Click(sender, e);
#endif
@@ -138,6 +156,7 @@ namespace TBF.UiControls
if ((OptionalButtons & Buttons.NewTab) != 0) newTabButton.Show();
if ((OptionalButtons & Buttons.RenameTab) != 0) renameTabButton.Show();
if ((OptionalButtons & Buttons.RemoveTab) != 0) removeTabButton.Show();
+ if ((OptionalButtons & Buttons.More) != 0) moreButton.Show();
lockState = LockState.Unlocked;
}
@@ -171,6 +190,7 @@ namespace TBF.UiControls
if ((buttons & Buttons.NewTab) != 0) newTabButton.Enabled = value;
if ((buttons & Buttons.RenameTab) != 0) renameTabButton.Enabled = value;
if ((buttons & Buttons.RemoveTab) != 0) removeTabButton.Enabled = value;
+ if ((buttons & Buttons.More) != 0) moreButton.Enabled = value;
}
void RestoreUser()
@@ -194,6 +214,7 @@ namespace TBF.UiControls
public event EventHandler NewTabClicked;
public event EventHandler RenameTabClicked;
public event EventHandler RemoveTabClicked;
+ public event EventHandler MoreClicked;
///
/// 'Unlock' button handler
@@ -234,6 +255,22 @@ namespace TBF.UiControls
}
}
+ private void moreButton_Click(object sender, EventArgs e)
+ {
+ if (MoreActive)
+ {
+ MoreActive = false;
+ moreButton.Text = Strings.MoreBtnText;
+ }
+ else
+ {
+ MoreActive = true;
+ moreButton.Text = Strings.LessBtnText;
+ }
+
+ if (MoreClicked != null) MoreClicked(sender, e);
+ }
+
///
/// All remaining handlers:
///