- RegulValve ADC Open/Close values calibration implemented
- 'More' button added to ComponentCfgCtrl-s - Dataflow from ComponentParametersDlg to components: CfgChangeHandler - Dataflow from components to ComponentParametersDlg: CmdResponseHandler - Detection of parameter changes and appropriate MesssageBox display: 1.warning message when component configuration change requires program restart 2.confirmation message box when any configuration changes would be lost
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,13 @@ namespace TBF.BenchControl
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Empty implementation, might be overriden in derived classes
|
||||
/// </summary>
|
||||
public static void ResetStaticProperties()
|
||||
{
|
||||
}
|
||||
/// <summary> Empty implementation, might be overriden in derived classes </summary>
|
||||
public static void ResetStaticProperties() { }
|
||||
|
||||
/// <summary> Empty implementation, might be overriden in derived classes </summary>
|
||||
public virtual void StartChangeHandler() { }
|
||||
|
||||
/// <summary> Empty implementation, might be overriden in derived classes </summary>
|
||||
public virtual void StopChangeHandler() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
/// </summary>
|
||||
/// <returns>See VerifyFlags</returns>
|
||||
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
|
||||
/// <summary>
|
||||
/// Save settings to the configuration class.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
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 (!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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
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 (!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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<CfgChangeArgs> 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<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+211
-1
@@ -46,6 +46,26 @@
|
||||
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
|
||||
@@ -205,10 +225,178 @@
|
||||
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);
|
||||
@@ -228,8 +416,13 @@
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "RegulValveCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 250);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,6 +76,11 @@ 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;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
///
|
||||
if (!config.Name.Equals(nameTextBox.Text))
|
||||
{
|
||||
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);
|
||||
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<CmdResponseArgs> 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -14,11 +14,25 @@
|
||||
/// <summary>
|
||||
/// Flags returned by each device configuration control Verify(...) function.
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
@@ -14,5 +14,9 @@ namespace TBF.BenchControl.Generic
|
||||
Entities.LogLevel LogLevel { get; }
|
||||
|
||||
IComponentCfg Cfg { get; }
|
||||
|
||||
void StartChangeHandler();
|
||||
|
||||
void StopChangeHandler();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,20 +9,31 @@ namespace TBF.BenchControl.Generic
|
||||
IComponentCfg Config { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <returns>See VerifyFlags</returns>
|
||||
CfgVerifyFlags VerifyCfg(ref string message);
|
||||
bool ShowMore { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Save settings to the configuration class.
|
||||
/// Unlock controls.
|
||||
/// </summary>
|
||||
void Unlock();
|
||||
|
||||
/// <summary>
|
||||
/// Save settings to the configuration class.
|
||||
/// Verify current user controls for validity.
|
||||
/// Called when user wants to close/save the configuration.
|
||||
/// </summary>
|
||||
void UpdateCfg();
|
||||
/// <returns>See VerifyFlags</returns>
|
||||
CfgUpdateFlags VerifyCfg(ref string message);
|
||||
|
||||
/// <summary>
|
||||
/// Save form parameters to the configuration class.
|
||||
/// </summary>
|
||||
CfgUpdateFlags UpdateCfg();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the dialog with component configuration control is closing.
|
||||
/// In this function CmdResponse handelrs (if any) should be closed, etc.
|
||||
/// </summary>
|
||||
void Closing();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+15
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace TBF
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags Flags;
|
||||
|
||||
/// <summary>
|
||||
/// List of components (=component configuration instances)
|
||||
/// </summary>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
/// <summary>
|
||||
/// ListViewEx columns
|
||||
/// </summary>
|
||||
@@ -52,6 +54,8 @@ namespace TBF
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
flags = CfgUpdateFlags.None;
|
||||
|
||||
selectComponentTypeDlg = new SelectComponentClassDlg();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
@@ -182,6 +186,8 @@ namespace TBF
|
||||
|
||||
/// OK
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
|
||||
{
|
||||
foreach (var cmpnt in toBeDeletedEntities)
|
||||
{
|
||||
@@ -197,6 +203,7 @@ namespace TBF
|
||||
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.
|
||||
|
||||
|
||||
+36
@@ -231,6 +231,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Changes will be lost. Do you want to proceed?.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Clear results.
|
||||
/// </summary>
|
||||
@@ -780,6 +789,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Less.
|
||||
/// </summary>
|
||||
internal static string LessBtnText {
|
||||
get {
|
||||
return ResourceManager.GetString("LessBtnText", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Loading the procedure.
|
||||
/// </summary>
|
||||
@@ -933,6 +951,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to More.
|
||||
/// </summary>
|
||||
internal static string MoreBtnText {
|
||||
get {
|
||||
return ResourceManager.GetString("MoreBtnText", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Name.
|
||||
/// </summary>
|
||||
@@ -1284,6 +1311,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Program restart is required to apply some settings.
|
||||
/// </summary>
|
||||
internal static string Program_restart_is_required_to_apply_some_settings {
|
||||
get {
|
||||
return ResourceManager.GetString("Program_restart_is_required_to_apply_some_settings", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Progress.
|
||||
/// </summary>
|
||||
|
||||
@@ -774,4 +774,10 @@
|
||||
<data name="Time2MassMsrmt_chdr" xml:space="preserve">
|
||||
<value>Stab.Zeit [s]</value>
|
||||
</data>
|
||||
<data name="LessBtnText" xml:space="preserve">
|
||||
<value>weniger</value>
|
||||
</data>
|
||||
<data name="MoreBtnText" xml:space="preserve">
|
||||
<value>mehr</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -862,4 +862,16 @@
|
||||
<data name="Time2MassMsrmt_chdr" xml:space="preserve">
|
||||
<value>Stab.time [s]</value>
|
||||
</data>
|
||||
<data name="LessBtnText" xml:space="preserve">
|
||||
<value>Less</value>
|
||||
</data>
|
||||
<data name="MoreBtnText" xml:space="preserve">
|
||||
<value>More</value>
|
||||
</data>
|
||||
<data name="Program_restart_is_required_to_apply_some_settings" xml:space="preserve">
|
||||
<value>Program restart is required to apply some settings</value>
|
||||
</data>
|
||||
<data name="Changes_will_be_lost_Do_you_want_to_proceed" xml:space="preserve">
|
||||
<value>Changes will be lost. Do you want to proceed?</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -159,6 +159,8 @@
|
||||
<Compile Include="BenchControl\Cameras\IdcCamera\Command\SetBrightness.cs" />
|
||||
<Compile Include="BenchControl\Cameras\IdcCamera\Command\StartNew.cs" />
|
||||
<Compile Include="BenchControl\Cameras\IdcCamera\Command\Stream.cs" />
|
||||
<Compile Include="BenchControl\CfgChangeArgs.cs" />
|
||||
<Compile Include="BenchControl\CmdResponseArgs.cs" />
|
||||
<Compile Include="BenchControl\ComponentBase.cs" />
|
||||
<Compile Include="BenchControl\Constants.cs" />
|
||||
<Compile Include="BenchControl\DataEntry\Munich3\CycleBeginningForm.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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace TBF.UiControls
|
||||
NewTab = 256, /// optional
|
||||
RenameTab = 512, /// optional
|
||||
RemoveTab = 1024, /// optional
|
||||
More = 2048, /// optional
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,6 +40,8 @@ namespace TBF.UiControls
|
||||
}
|
||||
LockState lockState;
|
||||
|
||||
public bool MoreActive;
|
||||
|
||||
/// <summary>
|
||||
/// 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;
|
||||
|
||||
/// <summary>
|
||||
/// '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:
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user