From f2005bbf56bdc9b18b3f6b68e0b893acc4dcde58 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Fri, 2 Jan 2015 19:14:19 +0100 Subject: [PATCH] Boilerplate code reduced from factories, GetComponent() and GetControl() added to cfg-s --- .../BenchControl/BenchId/ComponentCfg.cs | 7 ++++ .../BenchControl/BenchId/ComponentFactory.cs | 24 ++---------- .../Cameras/CameraRoi/CameraRoiCfg.cs | 19 ++++++++-- .../Cameras/CameraRoi/CameraRoiFactory.cs | 23 ++---------- .../Cameras/IdcCamera/IdcCameraCfg.cs | 7 ++++ .../Cameras/IdcCamera/IdcCameraFactory.cs | 23 ++---------- .../DataEntry/Munich/EntryFormCfg.cs | 7 ++++ .../DataEntry/Munich/EntryFormFactory.cs | 34 ++++------------- .../DataEntry/Munich3/EntryFormCfg.cs | 7 ++++ .../DataEntry/Munich3/EntryFormFactory.cs | 34 ++++------------- .../DataEntry/WMStates/EntryFormCfg.cs | 4 ++ .../DataEntry/WMStates/EntryFormFactory.cs | 24 ++---------- .../BenchControl/Elde/ControlBoardCfg.cs | 7 ++++ .../BenchControl/Elde/ControlBoardDev.cs | 2 +- .../BenchControl/Elde/ControlBoardFactory.cs | 4 +- .../BenchControl/Elde/Diverter/DiverterCfg.cs | 7 ++++ .../Elde/Diverter/DiverterFactory.cs | 26 ++----------- .../RegisterReaderCfg.cs | 4 ++ .../RegisterReaderFactory.cs | 33 ++++------------- .../Elde/FlowMeter/FlowMeterCfg.cs | 7 ++++ .../Elde/FlowMeter/FlowMeterFactory.cs | 37 ++++--------------- .../Elde/FlowMeterTwins/FlowMeterCfg.cs | 9 ++++- .../Elde/FlowMeterTwins/FlowMeterFactory.cs | 27 ++------------ .../Elde/PressureMeter/PressureMeterCfg.cs | 7 ++++ .../PressureMeter/PressureMeterFactory.cs | 28 ++------------ .../BenchControl/Elde/Pump/PumpCfg.cs | 7 ++++ .../BenchControl/Elde/Pump/PumpFactory.cs | 23 ++---------- .../BenchControl/Elde/PumpWithFM/PumpCfg.cs | 7 ++++ .../Elde/PumpWithFM/PumpFactory.cs | 33 ++++------------- .../Elde/RegisterReader/RegisterReaderCfg.cs | 7 ++++ .../RegisterReader/RegisterReaderFactory.cs | 23 ++---------- .../Elde/RegulValve/RegulValveCfg.cs | 7 ++++ .../Elde/RegulValve/RegulValveFactory.cs | 23 ++---------- .../Elde/TempMeter/TempMeterCfg.cs | 10 ++++- .../Elde/TempMeter/TempMeterFactory.cs | 23 ++---------- .../BenchControl/Elde/Valve/ValveCfg.cs | 9 ++++- .../BenchControl/Elde/Valve/ValveFactory.cs | 23 ++---------- .../BenchControl/Generic/IComponentCfg.cs | 6 +++ .../BenchControl/Generic/IComponentFactory.cs | 17 +-------- .../BenchControl/Greco/AmbientCfg.cs | 7 ++++ .../BenchControl/Greco/AmbientFactory.cs | 25 ++----------- .../BenchControl/MettlerToledo/BalanceCfg.cs | 11 ++++++ .../BenchControl/MettlerToledo/BalanceDev.cs | 2 +- .../MettlerToledo/BalanceFactory.cs | 4 +- .../MettlerToledo/BalanceNewDev.cs | 4 +- .../MettlerToledo/BalanceNewFactory.cs | 4 +- .../ResultsPrinters/Basic/PrinterCfg.cs | 4 ++ .../ResultsPrinters/Basic/PrinterFactory.cs | 34 ++++------------- .../ResultsPrinters/Munich/PrinterCfg.cs | 4 ++ .../ResultsPrinters/Munich/PrinterFactory.cs | 24 ++---------- .../ResultsWriters/Basic/WriterCfg.cs | 4 ++ .../ResultsWriters/Basic/WriterFactory.cs | 24 ++---------- .../BenchControl/TbfComponents.cs | 11 ++++-- .../CameraRoiDetection/RoiDetectionCfg.cs | 4 ++ .../CameraRoiDetection/RoiDetectionFactory.cs | 24 ++---------- .../CombinedMeters/TestMethodCfg.cs | 4 ++ .../CombinedMeters/TestMethodFactory.cs | 34 ++++------------- .../CombinedWithDetection/TestMethodCfg.cs | 4 ++ .../TestMethodFactory.cs | 34 ++++------------- .../FixedStartMassCollection/TestMethodCfg.cs | 4 ++ .../TestMethodFactory.cs | 34 ++++------------- .../TestMethods/FlyingStart/TestMethodCfg.cs | 4 ++ .../FlyingStart/TestMethodFactory.cs | 34 ++++------------- .../TestMethodCfg.cs | 4 ++ .../TestMethodFactory.cs | 34 ++++------------- .../TestMethodCfg.cs | 4 ++ .../TestMethodFactory.cs | 24 ++---------- .../BenchControl/WaterMeter/WaterMeterCfg.cs | 4 ++ .../WaterMeter/WaterMeterFactory.cs | 24 ++---------- TestBenchFramework/ComponentsManagerDlg.cs | 10 +++-- 70 files changed, 367 insertions(+), 708 deletions(-) diff --git a/TestBenchFramework/BenchControl/BenchId/ComponentCfg.cs b/TestBenchFramework/BenchControl/BenchId/ComponentCfg.cs index 399d12fba..6aeeae421 100644 --- a/TestBenchFramework/BenchControl/BenchId/ComponentCfg.cs +++ b/TestBenchFramework/BenchControl/BenchId/ComponentCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -9,6 +10,12 @@ namespace TBF.BenchControl.BenchId /// public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new Component(this); } + public IComponentCfgCtrl GetControl() { return new ComponentCfgCtrl(); } + + /// + /// Serialized parameters + /// public int TestBenchNr; /// Private parameterless constructor invoked by all other (public) constructors diff --git a/TestBenchFramework/BenchControl/BenchId/ComponentFactory.cs b/TestBenchFramework/BenchControl/BenchId/ComponentFactory.cs index 11a098324..d05e78ab6 100644 --- a/TestBenchFramework/BenchControl/BenchId/ComponentFactory.cs +++ b/TestBenchFramework/BenchControl/BenchId/ComponentFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.BenchId { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.BenchId { public string ClassName { get { return "Bench-ID"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return int.MaxValue; } } + public void ResetStaticProperties() { Component.ResetStaticProperties(); } - - public IComponentCfg DefaultConfig(IList components) - { - return new ComponentCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new ComponentCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new Component((ComponentCfg)config); - } + public IComponentCfg DefaultConfig() { return new ComponentCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(ComponentCfg), component, this); } - - public void ResetStaticProperties() { Component.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiCfg.cs b/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiCfg.cs index a4399650b..77b8a784a 100644 --- a/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiCfg.cs +++ b/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiCfg.cs @@ -1,4 +1,6 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; using System.IO.Ports; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,9 +9,17 @@ namespace TBF.BenchControl.Cameras.CameraRoi { public class CameraRoiCfg : ComponentCfgBase, IChildComponentCfg { + public IComponent GetComponent(IList components) { return new CameraRoi(this, components); } + public IComponentCfgCtrl GetControl() { return new CameraRoiCfgCtrl(); } + + /// + /// Serialized parameters + /// public int RoiNr; /// ROI number 1..4 - /// Procedure parameters + /// + /// Procedure parameters + /// [XmlIgnore] public RoiProcedureParams ProcParams; public override IParamsProvider GetProcedureParams() { return ProcParams; } @@ -23,10 +33,11 @@ namespace TBF.BenchControl.Cameras.CameraRoi /// Private parameterless constructor invoked by all other (public) constructors CameraRoiCfg() { - Name = "ROI"; + Name = "ROI"; ParentName = "Idc"; - RoiNr = 1; ProcParams = new RoiProcedureParams(); + + RoiNr = 1; } public CameraRoiCfg(IComponentFactory factory) diff --git a/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiFactory.cs b/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiFactory.cs index f3e4053d7..90a5eb385 100644 --- a/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiFactory.cs +++ b/TestBenchFramework/BenchControl/Cameras/CameraRoi/CameraRoiFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Cameras.CameraRoi { @@ -7,29 +6,13 @@ namespace TBF.BenchControl.Cameras.CameraRoi { public string ClassName { get { return "CameraROI"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 20; } } + public void ResetStaticProperties() { CameraRoi.ResetStaticProperties(); } - public IComponentCfg DefaultConfig(IList components) - { - return new CameraRoiCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new CameraRoiCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new CameraRoi((CameraRoiCfg)config, components); - } + public IComponentCfg DefaultConfig() { return new CameraRoiCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(CameraRoiCfg), component, this); } - - public void ResetStaticProperties() { CameraRoi.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfg.cs b/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfg.cs index a5164f1b2..de4245958 100644 --- a/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfg.cs +++ b/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraCfg.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Collections.Generic; using System.IO.Ports; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,12 @@ namespace TBF.BenchControl.Cameras.IdcCamera { public class IdcCameraCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new IdcCamera(this, components); } + public IComponentCfgCtrl GetControl() { return new IdcCameraCfgCtrl(); } + + /// + /// Serialized parameters + /// public int ComPortNr; /// Com port number 1..999 public int BaudRate; /// Baud rate 57600 or 115200 public float BrightnessCam; /// Relative brightness 0 .. 1.0f diff --git a/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraFactory.cs b/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraFactory.cs index d2a7948d5..e0a2f43a1 100644 --- a/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraFactory.cs +++ b/TestBenchFramework/BenchControl/Cameras/IdcCamera/IdcCameraFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Cameras.IdcCamera { @@ -7,29 +6,13 @@ namespace TBF.BenchControl.Cameras.IdcCamera { public string ClassName { get { return "IdcCamera"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 20; } } + public void ResetStaticProperties() { IdcCamera.ResetStaticProperties(); } - public IComponentCfg DefaultConfig(IList components) - { - return new IdcCameraCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new IdcCameraCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new IdcCamera((IdcCameraCfg)config, components); - } + public IComponentCfg DefaultConfig() { return new IdcCameraCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(IdcCameraCfg), component, this); } - - public void ResetStaticProperties() { IdcCamera.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormCfg.cs b/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormCfg.cs index 81496a960..b778f59df 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormCfg.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,12 @@ namespace TBF.BenchControl.DataEntry.Munich { public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new EntryForm(this); } + public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); } + + /// + /// Serialized parameters + /// public string ProtocolTitle1; public string ProtocolTitle2; public string ProtocolTitle3; diff --git a/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormFactory.cs b/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormFactory.cs index f116eb467..e33c7a67e 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormFactory.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Munich/EntryFormFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.DataEntry.Munich { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.DataEntry.Munich { public string ClassName { get { return "DataEntryForm-Munich"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } - - - public IComponentCfg DefaultConfig(IList components) - { - return new EntryFormCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new EntryFormCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new EntryForm((EntryFormCfg)config); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this); - } - public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormCfg.cs b/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormCfg.cs index b9685895a..11c326132 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormCfg.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,12 @@ namespace TBF.BenchControl.DataEntry.Munich3 { public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new EntryForm(this); } + public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); } + + /// + /// Serialized parameters + /// public string ProtocolTitle1; public string ProtocolTitle2; public string ProtocolTitle3; diff --git a/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormFactory.cs b/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormFactory.cs index dc10554f8..06edbf6af 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormFactory.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Munich3/EntryFormFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.DataEntry.Munich3 { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.DataEntry.Munich3 { public string ClassName { get { return "DataEntryForm-3"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } - - - public IComponentCfg DefaultConfig(IList components) - { - return new EntryFormCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new EntryFormCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new EntryForm((EntryFormCfg)config); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this); - } - public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormCfg.cs b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormCfg.cs index 1ab89388b..372365141 100644 --- a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormCfg.cs +++ b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.DataEntry.WMStates { public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new EntryForm(this); } + public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); } + /// Private parameterless constructor invoked by all other (public) constructors EntryFormCfg() { diff --git a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormFactory.cs b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormFactory.cs index aab9cdf95..3a2abe8bd 100644 --- a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormFactory.cs +++ b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryFormFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.DataEntry.WMStates { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.DataEntry.WMStates { public string ClassName { get { return "Generic-WM-States-Form"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } + public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); } - - public IComponentCfg DefaultConfig(IList components) - { - return new EntryFormCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new EntryFormCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new EntryForm((EntryFormCfg)config); - } + public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this); } - - public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Elde/ControlBoardCfg.cs b/TestBenchFramework/BenchControl/Elde/ControlBoardCfg.cs index 6394ff920..1d1b7d24e 100644 --- a/TestBenchFramework/BenchControl/Elde/ControlBoardCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/ControlBoardCfg.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Collections.Generic; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -6,6 +7,12 @@ namespace TBF.BenchControl.Elde { public class ControlBoardCfg : ComponentCfgBase, IComponentCfg { + public IComponent GetComponent(IList components) { return new ControlBoardDev(this); } + public IComponentCfgCtrl GetControl() { return new ControlBoardCfgCtrl(); } + + /// + /// Serialized parameters + /// public int ComPortNr; /// Private parameterless constructor invoked by all other (public) constructors diff --git a/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs b/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs index 457d445a5..a8875d24f 100644 --- a/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs +++ b/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs @@ -144,7 +144,7 @@ namespace TBF.BenchControl.Elde /// /// Constructor /// - public ControlBoardDev(ControlBoardCfg cfg, IList components) + public ControlBoardDev(ControlBoardCfg cfg) : base(cfg) { controlBoardCfg = cfg; diff --git a/TestBenchFramework/BenchControl/Elde/ControlBoardFactory.cs b/TestBenchFramework/BenchControl/Elde/ControlBoardFactory.cs index cc0a8dcf2..81a73b809 100644 --- a/TestBenchFramework/BenchControl/Elde/ControlBoardFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/ControlBoardFactory.cs @@ -11,7 +11,7 @@ namespace TBF.BenchControl.Elde /// Max. number of components of this class in the system public int MaxCount { get { return 1; } } - public IComponentCfg DefaultConfig(IList components) + public IComponentCfg DefaultConfig() { return new ControlBoardCfg(this); } @@ -23,7 +23,7 @@ namespace TBF.BenchControl.Elde public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) { - return new ControlBoardDev((ControlBoardCfg)config, components); + return new ControlBoardDev((ControlBoardCfg)config); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) diff --git a/TestBenchFramework/BenchControl/Elde/Diverter/DiverterCfg.cs b/TestBenchFramework/BenchControl/Elde/Diverter/DiverterCfg.cs index 7f5eb0927..f52fe3362 100644 --- a/TestBenchFramework/BenchControl/Elde/Diverter/DiverterCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/Diverter/DiverterCfg.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Collections.Generic; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -6,6 +7,12 @@ namespace TBF.BenchControl.Elde.Diverter { public class DiverterCfg : ComponentCfgBase, IChildComponentCfg { + public IComponent GetComponent(IList components) { return new Diverter(this, components); } + public IComponentCfgCtrl GetControl() { return new DiverterCfgCtrl(); } + + /// + /// Serialized parameters + /// public int BitPosition; /// Private parameterless constructor invoked by all other (public) constructors diff --git a/TestBenchFramework/BenchControl/Elde/Diverter/DiverterFactory.cs b/TestBenchFramework/BenchControl/Elde/Diverter/DiverterFactory.cs index 02b52e7be..8a1ee8c7a 100644 --- a/TestBenchFramework/BenchControl/Elde/Diverter/DiverterFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/Diverter/DiverterFactory.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.Diverter { @@ -10,29 +6,13 @@ namespace TBF.BenchControl.Elde.Diverter { public string ClassName { get { return "Diverter"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 5; } } + public void ResetStaticProperties() { Diverter.ResetStaticProperties(); } - public IComponentCfg DefaultConfig(IList components) - { - return new DiverterCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new DiverterCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new Diverter((DiverterCfg)config, components); - } + public IComponentCfg DefaultConfig() { return new DiverterCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(DiverterCfg), component, this); } - - public void ResetStaticProperties() { Diverter.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderCfg.cs b/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderCfg.cs index 6d84fca0b..69fda77cf 100644 --- a/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader { public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg { + public IComponent GetComponent(IList components) { return new RegisterReader(this, components); } + public IComponentCfgCtrl GetControl() { return new RegisterReaderCfgCtrl(); } + /// Procedure parameters [XmlIgnore] public RRProcedureParams ProcParams; diff --git a/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderFactory.cs b/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderFactory.cs index db2adb0fb..83e33b62a 100644 --- a/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/FixedStartRegisterReader/RegisterReaderFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.FixedStartRegisterReader { @@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader { public string ClassName { get { return "Fixed-Start-Register-Reader"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return Program.WMsCount; } } - - public IComponentCfg DefaultConfig(IList components) - { - return new RegisterReaderCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new RegisterReaderCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new RegisterReader((RegisterReaderCfg)config, components); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(RegisterReaderCfg), component, this); - } - public void ResetStaticProperties() { RegisterReader.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new RegisterReaderCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(RegisterReaderCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterCfg.cs b/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterCfg.cs index 76ae3ab01..4e943ecd5 100644 --- a/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,12 @@ namespace TBF.BenchControl.Elde.FlowMeter { public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg { + public IComponent GetComponent(IList components) { return new FlowMeter(this, components); } + public IComponentCfgCtrl GetControl() { return new FlowMeterCfgCtrl(); } + + /// + /// Serialized parameters + /// public int Idx1; /// 1..5 public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz diff --git a/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterFactory.cs b/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterFactory.cs index ccd572061..0d2fc1dda 100644 --- a/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/FlowMeter/FlowMeterFactory.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.FlowMeter { @@ -10,30 +6,13 @@ namespace TBF.BenchControl.Elde.FlowMeter { public string ClassName { get { return "FlowMeter"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 7; } } - - - public IComponentCfg DefaultConfig(IList components) - { - return new FlowMeterCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new FlowMeterCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new FlowMeter((FlowMeterCfg)config, components); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this); - } - public void ResetStaticProperties() { FlowMeter.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new FlowMeterCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterCfg.cs b/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterCfg.cs index 849156acf..f987b6e53 100644 --- a/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,7 +8,13 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins { public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg { - public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz + public IComponent GetComponent(IList components) { return new FlowMeter(this, components); } + public IComponentCfgCtrl GetControl() { return new FlowMeterCfgCtrl(); } + + /// + /// Serialized parameters + /// + public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz public string FlowMeter1; /// Name of the flow meter 1 component public string FlowMeter2; /// Name of the flow meter 2 component diff --git a/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterFactory.cs b/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterFactory.cs index a9df88ced..a6c6db4b1 100644 --- a/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/FlowMeterTwins/FlowMeterFactory.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.FlowMeterTwins { @@ -10,30 +6,13 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins { public string ClassName { get { return "FlowMeterTwins"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } + public void ResetStaticProperties() { FlowMeter.ResetStaticProperties(); } - - public IComponentCfg DefaultConfig(IList components) - { - return new FlowMeterCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new FlowMeterCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new FlowMeter((FlowMeterCfg)config, components); - } + public IComponentCfg DefaultConfig() { return new FlowMeterCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this); } - - public void ResetStaticProperties() { FlowMeter.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterCfg.cs b/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterCfg.cs index 7bde1f094..efbf33ca9 100644 --- a/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,12 @@ namespace TBF.BenchControl.Elde.PressureMeter { public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg { + public IComponent GetComponent(IList components) { return new PressureMeter(this, components); } + public IComponentCfgCtrl GetControl() { return new PressureMeterCfgCtrl(); } + + /// + /// Serialized parameters + /// public int Idx0; /// 0..3 public byte RS485Address; /// 0..255 diff --git a/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterFactory.cs b/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterFactory.cs index f7e7b7d34..3c613084f 100644 --- a/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/PressureMeter/PressureMeterFactory.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.PressureMeter { @@ -10,29 +6,13 @@ namespace TBF.BenchControl.Elde.PressureMeter { public string ClassName { get { return "PressureMeter"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 5; } } + public void ResetStaticProperties() { PressureMeter.ResetStaticProperties(); } - public IComponentCfg DefaultConfig(IList components) - { - return new PressureMeterCfg(this); - } + public IComponentCfg DefaultConfig() { return new PressureMeterCfg(this); } - public IComponentCfgCtrl CreateCfgCtrl() - { - return new PressureMeterCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new PressureMeter((PressureMeterCfg)config, components); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(PressureMeterCfg), component, this); } - - public void ResetStaticProperties() { PressureMeter.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfg.cs b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfg.cs index d6fe4272c..2b908428f 100644 --- a/TestBenchFramework/BenchControl/Elde/Pump/PumpCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/Pump/PumpCfg.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Collections.Generic; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -6,6 +7,12 @@ namespace TBF.BenchControl.Elde.Pump { public class PumpCfg : ComponentCfgBase, IChildComponentCfg { + public IComponent GetComponent(IList components) { return new Pump(this, components); } + public IComponentCfgCtrl GetControl() { return new PumpCfgCtrl(); } + + /// + /// Serialized parameters + /// public int BitPosition; public int Delay; diff --git a/TestBenchFramework/BenchControl/Elde/Pump/PumpFactory.cs b/TestBenchFramework/BenchControl/Elde/Pump/PumpFactory.cs index 6039e569e..9d434437d 100644 --- a/TestBenchFramework/BenchControl/Elde/Pump/PumpFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/Pump/PumpFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.Pump { @@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.Pump { public string ClassName { get { return "Pump"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return int.MaxValue; } } + public void ResetStaticProperties() { Pump.ResetStaticProperties(); } - public IComponentCfg DefaultConfig(IList components) - { - return new PumpCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new PumpCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new Pump((PumpCfg)config, components); - } + public IComponentCfg DefaultConfig() { return new PumpCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this); } - - public void ResetStaticProperties() { Pump.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfg.cs b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfg.cs index 325fe22a8..dd215f456 100644 --- a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpCfg.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Collections.Generic; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -6,6 +7,12 @@ namespace TBF.BenchControl.Elde.PumpWithFM { public class PumpCfg : ComponentCfgBase, IChildComponentCfg { + public IComponent GetComponent(IList components) { return new Pump(this, components); } + public IComponentCfgCtrl GetControl() { return new PumpCfgCtrl(); } + + /// + /// Serialized parameters + /// public int BitPosition; public int FMIndex; public int Delay; diff --git a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpFactory.cs b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpFactory.cs index dfede77c5..d83c0d9ea 100644 --- a/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/PumpWithFM/PumpFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.PumpWithFM { @@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.PumpWithFM { public string ClassName { get { return "PumpWithFM"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return int.MaxValue; } } - - public IComponentCfg DefaultConfig(IList components) - { - return new PumpCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new PumpCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new Pump((PumpCfg)config, components); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this); - } - public void ResetStaticProperties() { Pump.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new PumpCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderCfg.cs b/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderCfg.cs index c656d66fb..bb0864e85 100644 --- a/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,12 @@ namespace TBF.BenchControl.Elde.RegisterReader { public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg { + public IComponent GetComponent(IList components) { return new RegisterReader(this, components); } + public IComponentCfgCtrl GetControl() { return new RegisterReaderCfgCtrl(); } + + /// + /// Serialized parameters + /// public int Position; /// 1..nrWaterMeters /// Procedure parameters diff --git a/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderFactory.cs b/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderFactory.cs index 8f2458cd5..bc1647bb7 100644 --- a/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/RegisterReader/RegisterReaderFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.RegisterReader { @@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.RegisterReader { public string ClassName { get { return "RegisterReader"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return Program.WMsCount; } } + public void ResetStaticProperties() { RegisterReader.ResetStaticProperties(); } - public IComponentCfg DefaultConfig(IList components) - { - return new RegisterReaderCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new RegisterReaderCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new RegisterReader((RegisterReaderCfg)config, components); - } + public IComponentCfg DefaultConfig() { return new RegisterReaderCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(RegisterReaderCfg), component, this); } - - public void ResetStaticProperties() { RegisterReader.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs index e43eee635..97fab0fb4 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,12 @@ namespace TBF.BenchControl.Elde.RegulValve { public class RegulValveCfg : ComponentCfgBase, IChildComponentCfg { + public IComponent GetComponent(IList components) { return new RegulValve(this, components); } + public IComponentCfgCtrl GetControl() { return new RegulValveCfgCtrl(); } + + /// + /// Serialized parameters + /// public int Idx1; /// 1..7 public int DacValueClosed; /// 0..1023 public int DacValueOpen; /// 0..1023 diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveFactory.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveFactory.cs index 37bdc26e5..380168c23 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.RegulValve { @@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.RegulValve { public string ClassName { get { return "RegulationValve"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 5; } } + public void ResetStaticProperties() { RegulValve.ResetStaticProperties(); } - public IComponentCfg DefaultConfig(IList components) - { - return new RegulValveCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new RegulValveCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new RegulValve((RegulValveCfg)config, components); - } + public IComponentCfg DefaultConfig() { return new RegulValveCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(RegulValveCfg), component, this); } - - public void ResetStaticProperties() { RegulValve.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterCfg.cs b/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterCfg.cs index 6266088a9..664033a26 100644 --- a/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,8 +8,13 @@ namespace TBF.BenchControl.Elde.TempMeter { public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg { - public int Idx0; /// 0..7 - + public IComponent GetComponent(IList components) { return new TempMeter(this, components); } + public IComponentCfgCtrl GetControl() { return new TempMeterCfgCtrl(); } + + /// + /// Serialized parameters + /// + public int Idx0; /// 0..7 public float A1; public float A2; public float A3; diff --git a/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterFactory.cs b/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterFactory.cs index 95dfc1102..6e05e8f63 100644 --- a/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/TempMeter/TempMeterFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.TempMeter { @@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.TempMeter { public string ClassName { get { return "TempMeter"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 8; } } + public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); } - public IComponentCfg DefaultConfig(IList components) - { - return new TempMeterCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new TempMeterCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new TempMeter((TempMeterCfg)config, components); - } + public IComponentCfg DefaultConfig() { return new TempMeterCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(TempMeterCfg), component, this); } - - public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Elde/Valve/ValveCfg.cs b/TestBenchFramework/BenchControl/Elde/Valve/ValveCfg.cs index 9a9b2933a..d48d17504 100644 --- a/TestBenchFramework/BenchControl/Elde/Valve/ValveCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/Valve/ValveCfg.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Collections.Generic; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -6,7 +7,13 @@ namespace TBF.BenchControl.Elde.Valve { public class ValveCfg : ComponentCfgBase, IChildComponentCfg { - public int BitPosition; /// Bit-position + public IComponent GetComponent(IList components) { return new Valve(this, components); } + public IComponentCfgCtrl GetControl() { return new ValveCfgCtrl(); } + + /// + /// Serialized parameters + /// + public int BitPosition; /// Bit-position public ValveCategory Category; /// None, Feeding, Bench or Output public int OpenCloseTime; /// Delay for SetValvesOp operations public bool Inverted; /// The valve is inverted: 0=open, 1=closed diff --git a/TestBenchFramework/BenchControl/Elde/Valve/ValveFactory.cs b/TestBenchFramework/BenchControl/Elde/Valve/ValveFactory.cs index c14932e45..de68b91ba 100644 --- a/TestBenchFramework/BenchControl/Elde/Valve/ValveFactory.cs +++ b/TestBenchFramework/BenchControl/Elde/Valve/ValveFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.Valve { @@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.Valve { public string ClassName { get { return "Valve"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return int.MaxValue; } } + public void ResetStaticProperties() { Valve.ResetStaticProperties(); } - public IComponentCfg DefaultConfig(IList components) - { - return new ValveCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new ValveCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new Valve((ValveCfg)config, components); - } + public IComponentCfg DefaultConfig() { return new ValveCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(ValveCfg), component, this); } - - public void ResetStaticProperties() { Valve.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/Generic/IComponentCfg.cs b/TestBenchFramework/BenchControl/Generic/IComponentCfg.cs index 7077c4e0e..2bd60e685 100644 --- a/TestBenchFramework/BenchControl/Generic/IComponentCfg.cs +++ b/TestBenchFramework/BenchControl/Generic/IComponentCfg.cs @@ -44,6 +44,12 @@ namespace TBF.BenchControl.Generic /// TBF.Entities.Component CreateDbEntity(); + /// + /// Object instance factory-like methods + /// + IComponent GetComponent(IList components); + IComponentCfgCtrl GetControl(); + /// /// Procedure parameters provider support /// diff --git a/TestBenchFramework/BenchControl/Generic/IComponentFactory.cs b/TestBenchFramework/BenchControl/Generic/IComponentFactory.cs index 2a85d12a8..545f99d45 100644 --- a/TestBenchFramework/BenchControl/Generic/IComponentFactory.cs +++ b/TestBenchFramework/BenchControl/Generic/IComponentFactory.cs @@ -6,25 +6,10 @@ namespace TBF.BenchControl.Generic { string ClassName { get; } /// Name of the class of components (for instance "Valve") - /// - /// Max. number of components of this class in the system: 1, some integer value or int.MaxValue - /// - int MaxCount { get; } - /// /// Returns the default configuration /// - IComponentCfg DefaultConfig(IList components); - - /// - /// Returns the UserControl used inside ComponentConfigForm to display and edit the configuration - /// - IComponentCfgCtrl CreateCfgCtrl(); - - /// - /// Returns the component - /// - IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components); + IComponentCfg DefaultConfig(); /// /// Converts an Entities.Component object into an instance of an appropriate class implementing IComponentCfg diff --git a/TestBenchFramework/BenchControl/Greco/AmbientCfg.cs b/TestBenchFramework/BenchControl/Greco/AmbientCfg.cs index 7f6ba3fea..15bd59307 100644 --- a/TestBenchFramework/BenchControl/Greco/AmbientCfg.cs +++ b/TestBenchFramework/BenchControl/Greco/AmbientCfg.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Collections.Generic; using System.IO.Ports; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,12 @@ namespace TBF.BenchControl.Greco { public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new Ambient(this, components); } + public IComponentCfgCtrl GetControl() { return new AmbientCfgCtrl(); } + + /// + /// Serialized parameters + /// public int ComPortNr; public int BaudRate; public Parity Parity; diff --git a/TestBenchFramework/BenchControl/Greco/AmbientFactory.cs b/TestBenchFramework/BenchControl/Greco/AmbientFactory.cs index 24852ef52..db5a3159a 100644 --- a/TestBenchFramework/BenchControl/Greco/AmbientFactory.cs +++ b/TestBenchFramework/BenchControl/Greco/AmbientFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.Greco { @@ -7,29 +6,13 @@ namespace TBF.BenchControl.Greco { public string ClassName { get { return "Greco Ambient"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } + public void ResetStaticProperties() { Ambient.ResetStaticProperties(); } - public IComponentCfg DefaultConfig(IList components) - { - return new AmbientCfg(this); - } + public IComponentCfg DefaultConfig() { return new AmbientCfg(this); } - public IComponentCfgCtrl CreateCfgCtrl() - { - return new AmbientCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new Ambient((AmbientCfg)config, components); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(AmbientCfg), component, this); } - - public void ResetStaticProperties() { Ambient.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/MettlerToledo/BalanceCfg.cs b/TestBenchFramework/BenchControl/MettlerToledo/BalanceCfg.cs index 89fcab8b3..ccaf38485 100644 --- a/TestBenchFramework/BenchControl/MettlerToledo/BalanceCfg.cs +++ b/TestBenchFramework/BenchControl/MettlerToledo/BalanceCfg.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Collections.Generic; using System.IO.Ports; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,16 @@ namespace TBF.BenchControl.MettlerToledo { public class BalanceCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) + { + if (Factory.ClassName.Equals("MettlerToledo Balance")) return new BalanceDev(this); + else return new BalanceNewDev(this); + } + public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); } + + /// + /// Serialized parameters + /// public int ComPortNr; public int BaudRate; public Parity Parity; diff --git a/TestBenchFramework/BenchControl/MettlerToledo/BalanceDev.cs b/TestBenchFramework/BenchControl/MettlerToledo/BalanceDev.cs index dfbbdbd2f..69cbc1e9c 100644 --- a/TestBenchFramework/BenchControl/MettlerToledo/BalanceDev.cs +++ b/TestBenchFramework/BenchControl/MettlerToledo/BalanceDev.cs @@ -64,7 +64,7 @@ namespace TBF.BenchControl.MettlerToledo /// /// Balance properties /// A list of components loaded so far - public BalanceDev(BalanceCfg cfg, IList components) + public BalanceDev(BalanceCfg cfg) : base(cfg) { balanceCfg = cfg; diff --git a/TestBenchFramework/BenchControl/MettlerToledo/BalanceFactory.cs b/TestBenchFramework/BenchControl/MettlerToledo/BalanceFactory.cs index 1f440a15d..6d56a5141 100644 --- a/TestBenchFramework/BenchControl/MettlerToledo/BalanceFactory.cs +++ b/TestBenchFramework/BenchControl/MettlerToledo/BalanceFactory.cs @@ -10,7 +10,7 @@ namespace TBF.BenchControl.MettlerToledo /// Max. number of components of this class in the system public int MaxCount { get { return 5; } } - public IComponentCfg DefaultConfig(IList components) + public IComponentCfg DefaultConfig() { return new BalanceCfg(this); } @@ -22,7 +22,7 @@ namespace TBF.BenchControl.MettlerToledo public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) { - return new BalanceDev((BalanceCfg)config, components); + return new BalanceDev((BalanceCfg)config); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) diff --git a/TestBenchFramework/BenchControl/MettlerToledo/BalanceNewDev.cs b/TestBenchFramework/BenchControl/MettlerToledo/BalanceNewDev.cs index 0bf56acb4..f9906629a 100644 --- a/TestBenchFramework/BenchControl/MettlerToledo/BalanceNewDev.cs +++ b/TestBenchFramework/BenchControl/MettlerToledo/BalanceNewDev.cs @@ -27,8 +27,8 @@ namespace TBF.BenchControl.MettlerToledo public string SerialNumber { get { return serialNumber; } } string serialNumber; - public BalanceNewDev(BalanceCfg cfg, IList components) - : base(cfg, components) + public BalanceNewDev(BalanceCfg cfg) + : base(cfg) { log.Debug(this.ToString()); } diff --git a/TestBenchFramework/BenchControl/MettlerToledo/BalanceNewFactory.cs b/TestBenchFramework/BenchControl/MettlerToledo/BalanceNewFactory.cs index 8085d2359..08dcaf0a3 100644 --- a/TestBenchFramework/BenchControl/MettlerToledo/BalanceNewFactory.cs +++ b/TestBenchFramework/BenchControl/MettlerToledo/BalanceNewFactory.cs @@ -10,7 +10,7 @@ namespace TBF.BenchControl.MettlerToledo /// Max. number of components of this class in the system public int MaxCount { get { return 5; } } - public IComponentCfg DefaultConfig(IList components) + public IComponentCfg DefaultConfig() { return new BalanceCfg(this); } @@ -22,7 +22,7 @@ namespace TBF.BenchControl.MettlerToledo public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) { - return new BalanceNewDev((BalanceCfg)config, components); + return new BalanceNewDev((BalanceCfg)config); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfg.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfg.cs index 4d6027dcb..799f39da2 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfg.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.ResultsPrinters.Basic { public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new Printer(this); } + public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); } + /// Private parameterless constructor invoked by all other (public) constructors PrinterCfg() { diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterFactory.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterFactory.cs index ec4605b2b..a76d1f2c8 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterFactory.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Basic/PrinterFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.ResultsPrinters.Basic { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.ResultsPrinters.Basic { public string ClassName { get { return "BasicResultsPrinter"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } - - - public IComponentCfg DefaultConfig(IList components) - { - return new PrinterCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new PrinterCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new Printer((PrinterCfg)config); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this); - } - public void ResetStaticProperties() { Printer.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new PrinterCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterCfg.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterCfg.cs index b558f0e2d..c1f103cdc 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterCfg.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.ResultsPrinters.Munich { public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new Printer(this); } + public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); } + /// Procedure parameters [XmlIgnore] public ProcParams ProcParams; diff --git a/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterFactory.cs b/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterFactory.cs index 707b4b758..c945eeb6a 100644 --- a/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterFactory.cs +++ b/TestBenchFramework/BenchControl/ResultsPrinters/Munich/PrinterFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.ResultsPrinters.Munich { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.ResultsPrinters.Munich { public string ClassName { get { return "ResultsPrinter4Munich"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } + public void ResetStaticProperties() { Printer.ResetStaticProperties(); } - - public IComponentCfg DefaultConfig(IList components) - { - return new PrinterCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new PrinterCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new Printer((PrinterCfg)config); - } + public IComponentCfg DefaultConfig() { return new PrinterCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this); } - - public void ResetStaticProperties() { Printer.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfg.cs b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfg.cs index cdc98d97c..474ccaa32 100644 --- a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfg.cs +++ b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.ResultsWriters.Basic { public class WriterCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new Writer(this); } + public IComponentCfgCtrl GetControl() { return new WriterCfgCtrl(); } + /// Private parameterless constructor invoked by all other (public) constructors WriterCfg() { diff --git a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterFactory.cs b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterFactory.cs index 72c0d34d6..dab7ab39f 100644 --- a/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterFactory.cs +++ b/TestBenchFramework/BenchControl/ResultsWriters/Basic/WriterFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.ResultsWriters.Basic { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.ResultsWriters.Basic { public string ClassName { get { return "BasicResultsWriter"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } + public void ResetStaticProperties() { Writer.ResetStaticProperties(); } - - public IComponentCfg DefaultConfig(IList components) - { - return new WriterCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new WriterCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new Writer((WriterCfg)config); - } + public IComponentCfg DefaultConfig() { return new WriterCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(WriterCfg), component, this); } - - public void ResetStaticProperties() { Writer.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/TbfComponents.cs b/TestBenchFramework/BenchControl/TbfComponents.cs index c02f2b41c..58cfb0513 100644 --- a/TestBenchFramework/BenchControl/TbfComponents.cs +++ b/TestBenchFramework/BenchControl/TbfComponents.cs @@ -92,8 +92,7 @@ namespace TBF.BenchControl IComponentFactory cmpntFactory = BenchControl.TbfComponents.CmpntFactoryFromClassName(entity.ClassName); if (cmpntFactory == null) continue; - IComponent cmpnt = cmpntFactory - .ComponentFromCmpntCfg(cmpntFactory.CmpntCfgFromCmpntEntity(entity), components); + IComponent cmpnt = cmpntFactory.CmpntCfgFromCmpntEntity(entity).GetComponent(components); /// /// Inherit DebugMode from the parent (if any) @@ -134,10 +133,14 @@ namespace TBF.BenchControl /// Matching component or null public static IComponent FindComponent(string name, IList components) { - if (name == null) return null; - foreach (var cmpnt in components) if (cmpnt.Cfg.Name.Equals(name)) return cmpnt; + if (string.IsNullOrEmpty(name)) return null; + foreach (var cmpnt in components) + { + if (cmpnt.Cfg.Name.Equals(name)) return cmpnt; + } return null; } + public static IComponent FindComponent(string name) { return FindComponent(name, StateMachine.Components); diff --git a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionCfg.cs b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionCfg.cs index 5b1ab5d14..acb4e353e 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionCfg.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection { public class RoiDetectionCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new RoiDetection(this); } + public IComponentCfgCtrl GetControl() { return new RoiDetectionCfgCtrl(); } + /// Private parameterless constructor invoked by all other (public) constructors RoiDetectionCfg() { diff --git a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionFactory.cs b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionFactory.cs index c4c40349d..1e2ccf630 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionFactory.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.TestMethods.CameraRoiDetection { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection { public string ClassName { get { return "ROI Detection"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } + public void ResetStaticProperties() { RoiDetection.ResetStaticProperties(); } - - public IComponentCfg DefaultConfig(IList components) - { - return new RoiDetectionCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new RoiDetectionCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new RoiDetection((RoiDetectionCfg)config); - } + public IComponentCfg DefaultConfig() { return new RoiDetectionCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(RoiDetectionCfg), component, this); } - - public void ResetStaticProperties() { RoiDetection.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodCfg.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodCfg.cs index f3ce41943..f55d3e589 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodCfg.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters { public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new TestMethod(this); } + public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); } + /// Private parameterless constructor invoked by all other (public) constructors TestMethodCfg() { diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodFactory.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodFactory.cs index 05122fbfc..07f71880c 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodFactory.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethodFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.TestMethods.CombinedMeters { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters { public string ClassName { get { return "CombinedMeters"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } - - - public IComponentCfg DefaultConfig(IList components) - { - return new TestMethodCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new TestMethodCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new TestMethod((TestMethodCfg)config); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); - } - public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodCfg.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodCfg.cs index cacf9241e..02b4af235 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodCfg.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection { public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new TestMethod(this); } + public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); } + /// Test parameters [XmlIgnore] public CombinedWithDetTestParams TestParams; diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodFactory.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodFactory.cs index 1372e64c2..373a5e21c 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodFactory.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethodFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.TestMethods.CombinedWithDetection { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection { public string ClassName { get { return "CombinedWithDetection"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } - - - public IComponentCfg DefaultConfig(IList components) - { - return new TestMethodCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new TestMethodCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new TestMethod((TestMethodCfg)config); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); - } - public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodCfg.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodCfg.cs index 9733a1f44..98889cfbd 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodCfg.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection { public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new TestMethod(this); } + public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); } + /// Private parameterless constructor invoked by all other (public) constructors TestMethodCfg() { diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodFactory.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodFactory.cs index cdc97a7ea..451059444 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodFactory.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethodFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.TestMethods.FixedStartMassCollection { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection { public string ClassName { get { return "FixedStartMassCollection"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } - - - public IComponentCfg DefaultConfig(IList components) - { - return new TestMethodCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new TestMethodCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new TestMethod((TestMethodCfg)config); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); - } - public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodCfg.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodCfg.cs index 7b6bce81a..a592f974b 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodCfg.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart { public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new TestMethod(this); } + public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); } + /// Private parameterless constructor invoked by all other (public) constructors TestMethodCfg() { diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodFactory.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodFactory.cs index ac6661cd1..0f875c5ca 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodFactory.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethodFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.TestMethods.FlyingStart { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStart { public string ClassName { get { return "FlyingStart"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } - - - public IComponentCfg DefaultConfig(IList components) - { - return new TestMethodCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new TestMethodCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new TestMethod((TestMethodCfg)config); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); - } - public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfg.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfg.cs index ddca2ab17..8263cd0b2 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfg.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new TestMethod(this); } + public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); } + /// Private parameterless constructor invoked by all other (public) constructors TestMethodCfg() { diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodFactory.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodFactory.cs index 93e40acd9..bb27a1592 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodFactory.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { public string ClassName { get { return "Flying-Start-Collection"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } - - - public IComponentCfg DefaultConfig(IList components) - { - return new TestMethodCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new TestMethodCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new TestMethod((TestMethodCfg)config); - } - - public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); - } - public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); + } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodCfg.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodCfg.cs index bf9f56ea2..86ef507ac 100644 --- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodCfg.cs +++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration { public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new TestMethod(this); } + public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); } + /// Private parameterless constructor invoked by all other (public) constructors TestMethodCfg() { diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodFactory.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodFactory.cs index 88d7cc85f..31cdfb558 100644 --- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodFactory.cs +++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethodFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration { public string ClassName { get { return "ReferenceFlowmeterCalibration"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return 1; } } + public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); } - - public IComponentCfg DefaultConfig(IList components) - { - return new TestMethodCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new TestMethodCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new TestMethod((TestMethodCfg)config); - } + public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); } - - public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/BenchControl/WaterMeter/WaterMeterCfg.cs b/TestBenchFramework/BenchControl/WaterMeter/WaterMeterCfg.cs index 06107a8d8..2ed850810 100644 --- a/TestBenchFramework/BenchControl/WaterMeter/WaterMeterCfg.cs +++ b/TestBenchFramework/BenchControl/WaterMeter/WaterMeterCfg.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; @@ -8,6 +9,9 @@ namespace TBF.BenchControl.WaterMeter { public class WaterMeterCfg : ComponentCfgBase, Generic.IComponentCfg { + public IComponent GetComponent(IList components) { return new WaterMeter(this); } + public IComponentCfgCtrl GetControl() { return new WaterMeterCfgCtrl(); } + /// Procedure parameters [XmlIgnore] public ProcParams ProcParams; diff --git a/TestBenchFramework/BenchControl/WaterMeter/WaterMeterFactory.cs b/TestBenchFramework/BenchControl/WaterMeter/WaterMeterFactory.cs index 3dd8b9ee5..85b4c3a6c 100644 --- a/TestBenchFramework/BenchControl/WaterMeter/WaterMeterFactory.cs +++ b/TestBenchFramework/BenchControl/WaterMeter/WaterMeterFactory.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using TBF.BenchControl.Generic; +using TBF.BenchControl.Generic; namespace TBF.BenchControl.WaterMeter { @@ -7,30 +6,13 @@ namespace TBF.BenchControl.WaterMeter { public string ClassName { get { return "WaterMeter"; } } - /// Max. number of components of this class in the system - public int MaxCount { get { return int.MaxValue; } } + public void ResetStaticProperties() { WaterMeter.ResetStaticProperties(); } - - public IComponentCfg DefaultConfig(IList components) - { - return new WaterMeterCfg(this); - } - - public IComponentCfgCtrl CreateCfgCtrl() - { - return new WaterMeterCfgCtrl(); - } - - public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList components) - { - return new WaterMeter((WaterMeterCfg)config); - } + public IComponentCfg DefaultConfig() { return new WaterMeterCfg(this); } public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) { return ComponentCfgBase.CreateFromDbEntity(typeof(WaterMeterCfg), component, this); } - - public void ResetStaticProperties() { WaterMeter.ResetStaticProperties(); } } } diff --git a/TestBenchFramework/ComponentsManagerDlg.cs b/TestBenchFramework/ComponentsManagerDlg.cs index 4a39f3a2d..5d6f3e120 100644 --- a/TestBenchFramework/ComponentsManagerDlg.cs +++ b/TestBenchFramework/ComponentsManagerDlg.cs @@ -224,8 +224,9 @@ namespace TBF if (dr != DialogResult.OK) return; IComponentFactory factory = selectComponentTypeDlg.SlctdCmpntFactory; - IComponentCfgCtrl cfgControl = factory.CreateCfgCtrl(); - cfgControl.Config = factory.DefaultConfig(cmpntEntities); + IComponentCfg config = factory.DefaultConfig(); + IComponentCfgCtrl cfgControl = config.GetControl(); + cfgControl.Config = config; cfgControl.Config.ItemNr = listViewEx.Items.Count; ComponentParametersDlg cfgForm = new ComponentParametersDlg(); @@ -270,8 +271,9 @@ namespace TBF ComponentParametersDlg cfgForm = new ComponentParametersDlg(); cfgForm.TbfComponents = cmpntEntities; - cfgForm.ComponentCfgCtrl = TbfComponents.CmpntFactoryFromClassName(((Entities.Component)lvi.Tag).ClassName).CreateCfgCtrl(); - cfgForm.ComponentCfgCtrl.Config = TbfComponents.CmpntCfgFromCmpntEntity((Entities.Component)lvi.Tag); + IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity((Entities.Component)lvi.Tag); + cfgForm.ComponentCfgCtrl.Config = cfg; + cfgForm.ComponentCfgCtrl = cfg.GetControl(); DialogResult dr = cfgForm.ShowDialog(); if (dr != DialogResult.OK) return;