Boilerplate code reduced from factories, GetComponent() and GetControl() added to cfg-s

This commit is contained in:
Milan Hanajik
2015-01-02 19:14:19 +01:00
parent 94de991bf6
commit f2005bbf56
70 changed files with 367 additions and 708 deletions
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -9,6 +10,12 @@ namespace TBF.BenchControl.BenchId
/// </summary> /// </summary>
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new Component(this); }
public IComponentCfgCtrl GetControl() { return new ComponentCfgCtrl(); }
///
/// Serialized parameters
///
public int TestBenchNr; public int TestBenchNr;
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BenchId namespace TBF.BenchControl.BenchId
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.BenchId
{ {
public string ClassName { get { return "Bench-ID"; } } public string ClassName { get { return "Bench-ID"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { Component.ResetStaticProperties(); }
public int MaxCount { get { return int.MaxValue; } }
public IComponentCfg DefaultConfig() { return new ComponentCfg(this); }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new ComponentCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new ComponentCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new Component((ComponentCfg)config);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(ComponentCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(ComponentCfg), component, this);
} }
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,6 @@
using System.IO; using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Ports; using System.IO.Ports;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,9 +9,17 @@ namespace TBF.BenchControl.Cameras.CameraRoi
{ {
public class CameraRoiCfg : ComponentCfgBase, IChildComponentCfg public class CameraRoiCfg : ComponentCfgBase, IChildComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new CameraRoi(this, components); }
public IComponentCfgCtrl GetControl() { return new CameraRoiCfgCtrl(); }
///
/// Serialized parameters
///
public int RoiNr; /// ROI number 1..4 public int RoiNr; /// ROI number 1..4
/// <summary> Procedure parameters </summary> ///
/// Procedure parameters
///
[XmlIgnore] [XmlIgnore]
public RoiProcedureParams ProcParams; public RoiProcedureParams ProcParams;
public override IParamsProvider GetProcedureParams() { return 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 /// Private parameterless constructor invoked by all other (public) constructors
CameraRoiCfg() CameraRoiCfg()
{ {
Name = "ROI"; Name = "ROI";
ParentName = "Idc"; ParentName = "Idc";
RoiNr = 1;
ProcParams = new RoiProcedureParams(); ProcParams = new RoiProcedureParams();
RoiNr = 1;
} }
public CameraRoiCfg(IComponentFactory factory) public CameraRoiCfg(IComponentFactory factory)
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Cameras.CameraRoi namespace TBF.BenchControl.Cameras.CameraRoi
{ {
@@ -7,29 +6,13 @@ namespace TBF.BenchControl.Cameras.CameraRoi
{ {
public string ClassName { get { return "CameraROI"; } } public string ClassName { get { return "CameraROI"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { CameraRoi.ResetStaticProperties(); }
public int MaxCount { get { return 20; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig() { return new CameraRoiCfg(this); }
{
return new CameraRoiCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new CameraRoiCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new CameraRoi((CameraRoiCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(CameraRoiCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(CameraRoiCfg), component, this);
} }
public void ResetStaticProperties() { CameraRoi.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Collections.Generic;
using System.IO.Ports; using System.IO.Ports;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,12 @@ namespace TBF.BenchControl.Cameras.IdcCamera
{ {
public class IdcCameraCfg : ComponentCfgBase, Generic.IComponentCfg public class IdcCameraCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new IdcCamera(this, components); }
public IComponentCfgCtrl GetControl() { return new IdcCameraCfgCtrl(); }
///
/// Serialized parameters
///
public int ComPortNr; /// Com port number 1..999 public int ComPortNr; /// Com port number 1..999
public int BaudRate; /// Baud rate 57600 or 115200 public int BaudRate; /// Baud rate 57600 or 115200
public float BrightnessCam; /// Relative brightness 0 .. 1.0f public float BrightnessCam; /// Relative brightness 0 .. 1.0f
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Cameras.IdcCamera namespace TBF.BenchControl.Cameras.IdcCamera
{ {
@@ -7,29 +6,13 @@ namespace TBF.BenchControl.Cameras.IdcCamera
{ {
public string ClassName { get { return "IdcCamera"; } } public string ClassName { get { return "IdcCamera"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { IdcCamera.ResetStaticProperties(); }
public int MaxCount { get { return 20; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig() { return new IdcCameraCfg(this); }
{
return new IdcCameraCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new IdcCameraCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new IdcCamera((IdcCameraCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(IdcCameraCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(IdcCameraCfg), component, this);
} }
public void ResetStaticProperties() { IdcCamera.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,12 @@ namespace TBF.BenchControl.DataEntry.Munich
{ {
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new EntryForm(this); }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///
/// Serialized parameters
///
public string ProtocolTitle1; public string ProtocolTitle1;
public string ProtocolTitle2; public string ProtocolTitle2;
public string ProtocolTitle3; public string ProtocolTitle3;
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Munich namespace TBF.BenchControl.DataEntry.Munich
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.DataEntry.Munich
{ {
public string ClassName { get { return "DataEntryForm-Munich"; } } public string ClassName { get { return "DataEntryForm-Munich"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new EntryFormCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new EntryFormCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,12 @@ namespace TBF.BenchControl.DataEntry.Munich3
{ {
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new EntryForm(this); }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///
/// Serialized parameters
///
public string ProtocolTitle1; public string ProtocolTitle1;
public string ProtocolTitle2; public string ProtocolTitle2;
public string ProtocolTitle3; public string ProtocolTitle3;
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Munich3 namespace TBF.BenchControl.DataEntry.Munich3
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.DataEntry.Munich3
{ {
public string ClassName { get { return "DataEntryForm-3"; } } public string ClassName { get { return "DataEntryForm-3"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new EntryFormCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new EntryFormCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.DataEntry.WMStates
{ {
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new EntryForm(this); }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
EntryFormCfg() EntryFormCfg()
{ {
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.WMStates namespace TBF.BenchControl.DataEntry.WMStates
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.DataEntry.WMStates
{ {
public string ClassName { get { return "Generic-WM-States-Form"; } } public string ClassName { get { return "Generic-WM-States-Form"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new EntryFormCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new EntryFormCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new EntryForm((EntryFormCfg)config);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
} }
public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -6,6 +7,12 @@ namespace TBF.BenchControl.Elde
{ {
public class ControlBoardCfg : ComponentCfgBase, IComponentCfg public class ControlBoardCfg : ComponentCfgBase, IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new ControlBoardDev(this); }
public IComponentCfgCtrl GetControl() { return new ControlBoardCfgCtrl(); }
///
/// Serialized parameters
///
public int ComPortNr; public int ComPortNr;
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
@@ -144,7 +144,7 @@ namespace TBF.BenchControl.Elde
/// <summary> /// <summary>
/// Constructor /// Constructor
/// </summary> /// </summary>
public ControlBoardDev(ControlBoardCfg cfg, IList<Generic.IComponent> components) public ControlBoardDev(ControlBoardCfg cfg)
: base(cfg) : base(cfg)
{ {
controlBoardCfg = cfg; controlBoardCfg = cfg;
@@ -11,7 +11,7 @@ namespace TBF.BenchControl.Elde
/// <summary>Max. number of components of this class in the system</summary> /// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } } public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig()
{ {
return new ControlBoardCfg(this); return new ControlBoardCfg(this);
} }
@@ -23,7 +23,7 @@ namespace TBF.BenchControl.Elde
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components) public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{ {
return new ControlBoardDev((ControlBoardCfg)config, components); return new ControlBoardDev((ControlBoardCfg)config);
} }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
@@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -6,6 +7,12 @@ namespace TBF.BenchControl.Elde.Diverter
{ {
public class DiverterCfg : ComponentCfgBase, IChildComponentCfg public class DiverterCfg : ComponentCfgBase, IChildComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new Diverter(this, components); }
public IComponentCfgCtrl GetControl() { return new DiverterCfgCtrl(); }
///
/// Serialized parameters
///
public int BitPosition; public int BitPosition;
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
@@ -1,8 +1,4 @@
using System; using TBF.BenchControl.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.Diverter namespace TBF.BenchControl.Elde.Diverter
{ {
@@ -10,29 +6,13 @@ namespace TBF.BenchControl.Elde.Diverter
{ {
public string ClassName { get { return "Diverter"; } } public string ClassName { get { return "Diverter"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { Diverter.ResetStaticProperties(); }
public int MaxCount { get { return 5; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig() { return new DiverterCfg(this); }
{
return new DiverterCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new DiverterCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new Diverter((DiverterCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(DiverterCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(DiverterCfg), component, this);
} }
public void ResetStaticProperties() { Diverter.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
{ {
public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new RegisterReader(this, components); }
public IComponentCfgCtrl GetControl() { return new RegisterReaderCfgCtrl(); }
/// <summary> Procedure parameters </summary> /// <summary> Procedure parameters </summary>
[XmlIgnore] [XmlIgnore]
public RRProcedureParams ProcParams; public RRProcedureParams ProcParams;
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FixedStartRegisterReader namespace TBF.BenchControl.Elde.FixedStartRegisterReader
{ {
@@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
{ {
public string ClassName { get { return "Fixed-Start-Register-Reader"; } } public string ClassName { get { return "Fixed-Start-Register-Reader"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return Program.WMsCount; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new RegisterReaderCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new RegisterReaderCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { RegisterReader.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new RegisterReaderCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(RegisterReaderCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,12 @@ namespace TBF.BenchControl.Elde.FlowMeter
{ {
public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new FlowMeter(this, components); }
public IComponentCfgCtrl GetControl() { return new FlowMeterCfgCtrl(); }
///
/// Serialized parameters
///
public int Idx1; /// 1..5 public int Idx1; /// 1..5
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
@@ -1,8 +1,4 @@
using System; using TBF.BenchControl.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeter namespace TBF.BenchControl.Elde.FlowMeter
{ {
@@ -10,30 +6,13 @@ namespace TBF.BenchControl.Elde.FlowMeter
{ {
public string ClassName { get { return "FlowMeter"; } } public string ClassName { get { return "FlowMeter"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 7; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new FlowMeterCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new FlowMeterCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { FlowMeter.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new FlowMeterCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,7 +8,13 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
{ {
public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg
{ {
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz public IComponent GetComponent(IList<IComponent> 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 FlowMeter1; /// Name of the flow meter 1 component
public string FlowMeter2; /// Name of the flow meter 2 component public string FlowMeter2; /// Name of the flow meter 2 component
@@ -1,8 +1,4 @@
using System; using TBF.BenchControl.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeterTwins namespace TBF.BenchControl.Elde.FlowMeterTwins
{ {
@@ -10,30 +6,13 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
{ {
public string ClassName { get { return "FlowMeterTwins"; } } public string ClassName { get { return "FlowMeterTwins"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { FlowMeter.ResetStaticProperties(); }
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig() { return new FlowMeterCfg(this); }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new FlowMeterCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new FlowMeterCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new FlowMeter((FlowMeterCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this);
} }
public void ResetStaticProperties() { FlowMeter.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,12 @@ namespace TBF.BenchControl.Elde.PressureMeter
{ {
public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new PressureMeter(this, components); }
public IComponentCfgCtrl GetControl() { return new PressureMeterCfgCtrl(); }
///
/// Serialized parameters
///
public int Idx0; /// 0..3 public int Idx0; /// 0..3
public byte RS485Address; /// 0..255 public byte RS485Address; /// 0..255
@@ -1,8 +1,4 @@
using System; using TBF.BenchControl.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.PressureMeter namespace TBF.BenchControl.Elde.PressureMeter
{ {
@@ -10,29 +6,13 @@ namespace TBF.BenchControl.Elde.PressureMeter
{ {
public string ClassName { get { return "PressureMeter"; } } public string ClassName { get { return "PressureMeter"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { PressureMeter.ResetStaticProperties(); }
public int MaxCount { get { return 5; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig() { return new PressureMeterCfg(this); }
{
return new PressureMeterCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl() public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return new PressureMeterCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new PressureMeter((PressureMeterCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(PressureMeterCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(PressureMeterCfg), component, this);
} }
public void ResetStaticProperties() { PressureMeter.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -6,6 +7,12 @@ namespace TBF.BenchControl.Elde.Pump
{ {
public class PumpCfg : ComponentCfgBase, IChildComponentCfg public class PumpCfg : ComponentCfgBase, IChildComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new Pump(this, components); }
public IComponentCfgCtrl GetControl() { return new PumpCfgCtrl(); }
///
/// Serialized parameters
///
public int BitPosition; public int BitPosition;
public int Delay; public int Delay;
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.Pump namespace TBF.BenchControl.Elde.Pump
{ {
@@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.Pump
{ {
public string ClassName { get { return "Pump"; } } public string ClassName { get { return "Pump"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { Pump.ResetStaticProperties(); }
public int MaxCount { get { return int.MaxValue; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig() { return new PumpCfg(this); }
{
return new PumpCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new PumpCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new Pump((PumpCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this);
} }
public void ResetStaticProperties() { Pump.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -6,6 +7,12 @@ namespace TBF.BenchControl.Elde.PumpWithFM
{ {
public class PumpCfg : ComponentCfgBase, IChildComponentCfg public class PumpCfg : ComponentCfgBase, IChildComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new Pump(this, components); }
public IComponentCfgCtrl GetControl() { return new PumpCfgCtrl(); }
///
/// Serialized parameters
///
public int BitPosition; public int BitPosition;
public int FMIndex; public int FMIndex;
public int Delay; public int Delay;
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.PumpWithFM namespace TBF.BenchControl.Elde.PumpWithFM
{ {
@@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.PumpWithFM
{ {
public string ClassName { get { return "PumpWithFM"; } } public string ClassName { get { return "PumpWithFM"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return int.MaxValue; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new PumpCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new PumpCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { Pump.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new PumpCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,12 @@ namespace TBF.BenchControl.Elde.RegisterReader
{ {
public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new RegisterReader(this, components); }
public IComponentCfgCtrl GetControl() { return new RegisterReaderCfgCtrl(); }
///
/// Serialized parameters
///
public int Position; /// 1..nrWaterMeters public int Position; /// 1..nrWaterMeters
/// <summary> Procedure parameters </summary> /// <summary> Procedure parameters </summary>
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.RegisterReader namespace TBF.BenchControl.Elde.RegisterReader
{ {
@@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.RegisterReader
{ {
public string ClassName { get { return "RegisterReader"; } } public string ClassName { get { return "RegisterReader"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { RegisterReader.ResetStaticProperties(); }
public int MaxCount { get { return Program.WMsCount; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig() { return new RegisterReaderCfg(this); }
{
return new RegisterReaderCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new RegisterReaderCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new RegisterReader((RegisterReaderCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(RegisterReaderCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(RegisterReaderCfg), component, this);
} }
public void ResetStaticProperties() { RegisterReader.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,12 @@ namespace TBF.BenchControl.Elde.RegulValve
{ {
public class RegulValveCfg : ComponentCfgBase, IChildComponentCfg public class RegulValveCfg : ComponentCfgBase, IChildComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new RegulValve(this, components); }
public IComponentCfgCtrl GetControl() { return new RegulValveCfgCtrl(); }
///
/// Serialized parameters
///
public int Idx1; /// 1..7 public int Idx1; /// 1..7
public int DacValueClosed; /// 0..1023 public int DacValueClosed; /// 0..1023
public int DacValueOpen; /// 0..1023 public int DacValueOpen; /// 0..1023
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.RegulValve namespace TBF.BenchControl.Elde.RegulValve
{ {
@@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.RegulValve
{ {
public string ClassName { get { return "RegulationValve"; } } public string ClassName { get { return "RegulationValve"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { RegulValve.ResetStaticProperties(); }
public int MaxCount { get { return 5; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig() { return new RegulValveCfg(this); }
{
return new RegulValveCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new RegulValveCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new RegulValve((RegulValveCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(RegulValveCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(RegulValveCfg), component, this);
} }
public void ResetStaticProperties() { RegulValve.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,8 +8,13 @@ namespace TBF.BenchControl.Elde.TempMeter
{ {
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg
{ {
public int Idx0; /// 0..7 public IComponent GetComponent(IList<IComponent> components) { return new TempMeter(this, components); }
public IComponentCfgCtrl GetControl() { return new TempMeterCfgCtrl(); }
///
/// Serialized parameters
///
public int Idx0; /// 0..7
public float A1; public float A1;
public float A2; public float A2;
public float A3; public float A3;
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.TempMeter namespace TBF.BenchControl.Elde.TempMeter
{ {
@@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.TempMeter
{ {
public string ClassName { get { return "TempMeter"; } } public string ClassName { get { return "TempMeter"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); }
public int MaxCount { get { return 8; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig() { return new TempMeterCfg(this); }
{
return new TempMeterCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new TempMeterCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new TempMeter((TempMeterCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(TempMeterCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(TempMeterCfg), component, this);
} }
public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -6,7 +7,13 @@ namespace TBF.BenchControl.Elde.Valve
{ {
public class ValveCfg : ComponentCfgBase, IChildComponentCfg public class ValveCfg : ComponentCfgBase, IChildComponentCfg
{ {
public int BitPosition; /// Bit-position public IComponent GetComponent(IList<IComponent> 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 ValveCategory Category; /// None, Feeding, Bench or Output
public int OpenCloseTime; /// Delay for SetValvesOp operations public int OpenCloseTime; /// Delay for SetValvesOp operations
public bool Inverted; /// The valve is inverted: 0=open, 1=closed public bool Inverted; /// The valve is inverted: 0=open, 1=closed
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.Valve namespace TBF.BenchControl.Elde.Valve
{ {
@@ -7,29 +6,13 @@ namespace TBF.BenchControl.Elde.Valve
{ {
public string ClassName { get { return "Valve"; } } public string ClassName { get { return "Valve"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { Valve.ResetStaticProperties(); }
public int MaxCount { get { return int.MaxValue; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig() { return new ValveCfg(this); }
{
return new ValveCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new ValveCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new Valve((ValveCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(ValveCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(ValveCfg), component, this);
} }
public void ResetStaticProperties() { Valve.ResetStaticProperties(); }
} }
} }
@@ -44,6 +44,12 @@ namespace TBF.BenchControl.Generic
/// </summary> /// </summary>
TBF.Entities.Component CreateDbEntity(); TBF.Entities.Component CreateDbEntity();
///
/// Object instance factory-like methods
///
IComponent GetComponent(IList<IComponent> components);
IComponentCfgCtrl GetControl();
/// ///
/// Procedure parameters provider support /// Procedure parameters provider support
/// ///
@@ -6,25 +6,10 @@ namespace TBF.BenchControl.Generic
{ {
string ClassName { get; } /// Name of the class of components (for instance "Valve") string ClassName { get; } /// Name of the class of components (for instance "Valve")
/// <summary>
/// Max. number of components of this class in the system: 1, some integer value or int.MaxValue
/// </summary>
int MaxCount { get; }
/// <summary> /// <summary>
/// Returns the default configuration /// Returns the default configuration
/// </summary> /// </summary>
IComponentCfg DefaultConfig(IList<Entities.Component> components); IComponentCfg DefaultConfig();
/// <summary>
/// Returns the UserControl used inside ComponentConfigForm to display and edit the configuration
/// </summary>
IComponentCfgCtrl CreateCfgCtrl();
/// <summary>
/// Returns the component
/// </summary>
IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components);
/// <summary> /// <summary>
/// Converts an Entities.Component object into an instance of an appropriate class implementing IComponentCfg /// Converts an Entities.Component object into an instance of an appropriate class implementing IComponentCfg
@@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Collections.Generic;
using System.IO.Ports; using System.IO.Ports;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,12 @@ namespace TBF.BenchControl.Greco
{ {
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new Ambient(this, components); }
public IComponentCfgCtrl GetControl() { return new AmbientCfgCtrl(); }
///
/// Serialized parameters
///
public int ComPortNr; public int ComPortNr;
public int BaudRate; public int BaudRate;
public Parity Parity; public Parity Parity;
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Greco namespace TBF.BenchControl.Greco
{ {
@@ -7,29 +6,13 @@ namespace TBF.BenchControl.Greco
{ {
public string ClassName { get { return "Greco Ambient"; } } public string ClassName { get { return "Greco Ambient"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { Ambient.ResetStaticProperties(); }
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig() { return new AmbientCfg(this); }
{
return new AmbientCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl() public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return new AmbientCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new Ambient((AmbientCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(AmbientCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(AmbientCfg), component, this);
} }
public void ResetStaticProperties() { Ambient.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Collections.Generic;
using System.IO.Ports; using System.IO.Ports;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,16 @@ namespace TBF.BenchControl.MettlerToledo
{ {
public class BalanceCfg : ComponentCfgBase, Generic.IComponentCfg public class BalanceCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> 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 ComPortNr;
public int BaudRate; public int BaudRate;
public Parity Parity; public Parity Parity;
@@ -64,7 +64,7 @@ namespace TBF.BenchControl.MettlerToledo
/// </summary> /// </summary>
/// <param name="cfg">Balance properties</param> /// <param name="cfg">Balance properties</param>
/// <param components="cfg">A list of components loaded so far</param> /// <param components="cfg">A list of components loaded so far</param>
public BalanceDev(BalanceCfg cfg, IList<Generic.IComponent> components) public BalanceDev(BalanceCfg cfg)
: base(cfg) : base(cfg)
{ {
balanceCfg = cfg; balanceCfg = cfg;
@@ -10,7 +10,7 @@ namespace TBF.BenchControl.MettlerToledo
/// <summary>Max. number of components of this class in the system</summary> /// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 5; } } public int MaxCount { get { return 5; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig()
{ {
return new BalanceCfg(this); return new BalanceCfg(this);
} }
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.MettlerToledo
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components) public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{ {
return new BalanceDev((BalanceCfg)config, components); return new BalanceDev((BalanceCfg)config);
} }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
@@ -27,8 +27,8 @@ namespace TBF.BenchControl.MettlerToledo
public string SerialNumber { get { return serialNumber; } } public string SerialNumber { get { return serialNumber; } }
string serialNumber; string serialNumber;
public BalanceNewDev(BalanceCfg cfg, IList<Generic.IComponent> components) public BalanceNewDev(BalanceCfg cfg)
: base(cfg, components) : base(cfg)
{ {
log.Debug(this.ToString()); log.Debug(this.ToString());
} }
@@ -10,7 +10,7 @@ namespace TBF.BenchControl.MettlerToledo
/// <summary>Max. number of components of this class in the system</summary> /// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 5; } } public int MaxCount { get { return 5; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig()
{ {
return new BalanceCfg(this); return new BalanceCfg(this);
} }
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.MettlerToledo
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components) public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{ {
return new BalanceNewDev((BalanceCfg)config, components); return new BalanceNewDev((BalanceCfg)config);
} }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
{ {
public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new Printer(this); }
public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
PrinterCfg() PrinterCfg()
{ {
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.ResultsPrinters.Basic namespace TBF.BenchControl.ResultsPrinters.Basic
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
{ {
public string ClassName { get { return "BasicResultsPrinter"; } } public string ClassName { get { return "BasicResultsPrinter"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new PrinterCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new PrinterCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { Printer.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new PrinterCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
{ {
public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new Printer(this); }
public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); }
/// <summary> Procedure parameters </summary> /// <summary> Procedure parameters </summary>
[XmlIgnore] [XmlIgnore]
public ProcParams ProcParams; public ProcParams ProcParams;
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.ResultsPrinters.Munich namespace TBF.BenchControl.ResultsPrinters.Munich
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
{ {
public string ClassName { get { return "ResultsPrinter4Munich"; } } public string ClassName { get { return "ResultsPrinter4Munich"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig() { return new PrinterCfg(this); }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new PrinterCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new PrinterCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new Printer((PrinterCfg)config);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this);
} }
public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.ResultsWriters.Basic
{ {
public class WriterCfg : ComponentCfgBase, Generic.IComponentCfg public class WriterCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new Writer(this); }
public IComponentCfgCtrl GetControl() { return new WriterCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
WriterCfg() WriterCfg()
{ {
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.ResultsWriters.Basic namespace TBF.BenchControl.ResultsWriters.Basic
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.ResultsWriters.Basic
{ {
public string ClassName { get { return "BasicResultsWriter"; } } public string ClassName { get { return "BasicResultsWriter"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { Writer.ResetStaticProperties(); }
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig() { return new WriterCfg(this); }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new WriterCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new WriterCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new Writer((WriterCfg)config);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(WriterCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(WriterCfg), component, this);
} }
public void ResetStaticProperties() { Writer.ResetStaticProperties(); }
} }
} }
@@ -92,8 +92,7 @@ namespace TBF.BenchControl
IComponentFactory cmpntFactory = BenchControl.TbfComponents.CmpntFactoryFromClassName(entity.ClassName); IComponentFactory cmpntFactory = BenchControl.TbfComponents.CmpntFactoryFromClassName(entity.ClassName);
if (cmpntFactory == null) continue; if (cmpntFactory == null) continue;
IComponent cmpnt = cmpntFactory IComponent cmpnt = cmpntFactory.CmpntCfgFromCmpntEntity(entity).GetComponent(components);
.ComponentFromCmpntCfg(cmpntFactory.CmpntCfgFromCmpntEntity(entity), components);
/// ///
/// Inherit DebugMode from the parent (if any) /// Inherit DebugMode from the parent (if any)
@@ -134,10 +133,14 @@ namespace TBF.BenchControl
/// <returns>Matching component or null</returns> /// <returns>Matching component or null</returns>
public static IComponent FindComponent(string name, IList<IComponent> components) public static IComponent FindComponent(string name, IList<IComponent> components)
{ {
if (name == null) return null; if (string.IsNullOrEmpty(name)) return null;
foreach (var cmpnt in components) if (cmpnt.Cfg.Name.Equals(name)) return cmpnt; foreach (var cmpnt in components)
{
if (cmpnt.Cfg.Name.Equals(name)) return cmpnt;
}
return null; return null;
} }
public static IComponent FindComponent(string name) public static IComponent FindComponent(string name)
{ {
return FindComponent(name, StateMachine.Components); return FindComponent(name, StateMachine.Components);
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
{ {
public class RoiDetectionCfg : ComponentCfgBase, Generic.IComponentCfg public class RoiDetectionCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new RoiDetection(this); }
public IComponentCfgCtrl GetControl() { return new RoiDetectionCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
RoiDetectionCfg() RoiDetectionCfg()
{ {
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.CameraRoiDetection namespace TBF.BenchControl.TestMethods.CameraRoiDetection
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
{ {
public string ClassName { get { return "ROI Detection"; } } public string ClassName { get { return "ROI Detection"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { RoiDetection.ResetStaticProperties(); }
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig() { return new RoiDetectionCfg(this); }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new RoiDetectionCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new RoiDetectionCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new RoiDetection((RoiDetectionCfg)config);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(RoiDetectionCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(RoiDetectionCfg), component, this);
} }
public void ResetStaticProperties() { RoiDetection.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
{ {
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new TestMethod(this); }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg() TestMethodCfg()
{ {
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.CombinedMeters namespace TBF.BenchControl.TestMethods.CombinedMeters
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
{ {
public string ClassName { get { return "CombinedMeters"; } } public string ClassName { get { return "CombinedMeters"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new TestMethodCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new TestMethodCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
{ {
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new TestMethod(this); }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary> /// <summary> Test parameters </summary>
[XmlIgnore] [XmlIgnore]
public CombinedWithDetTestParams TestParams; public CombinedWithDetTestParams TestParams;
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.CombinedWithDetection namespace TBF.BenchControl.TestMethods.CombinedWithDetection
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
{ {
public string ClassName { get { return "CombinedWithDetection"; } } public string ClassName { get { return "CombinedWithDetection"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new TestMethodCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new TestMethodCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
{ {
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new TestMethod(this); }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg() TestMethodCfg()
{ {
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollection namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
{ {
public string ClassName { get { return "FixedStartMassCollection"; } } public string ClassName { get { return "FixedStartMassCollection"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new TestMethodCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new TestMethodCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
{ {
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new TestMethod(this); }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg() TestMethodCfg()
{ {
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FlyingStart namespace TBF.BenchControl.TestMethods.FlyingStart
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
{ {
public string ClassName { get { return "FlyingStart"; } } public string ClassName { get { return "FlyingStart"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new TestMethodCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new TestMethodCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
{ {
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new TestMethod(this); }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg() TestMethodCfg()
{ {
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
{ {
public string ClassName { get { return "Flying-Start-Collection"; } } public string ClassName { get { return "Flying-Start-Collection"; } }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new TestMethodCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new TestMethodCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> 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 void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
}
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -7,6 +8,9 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
{ {
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new TestMethod(this); }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg() TestMethodCfg()
{ {
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
{ {
public string ClassName { get { return "ReferenceFlowmeterCalibration"; } } public string ClassName { get { return "ReferenceFlowmeterCalibration"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new TestMethodCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new TestMethodCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new TestMethod((TestMethodCfg)config);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
} }
public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
} }
} }
@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -8,6 +9,9 @@ namespace TBF.BenchControl.WaterMeter
{ {
public class WaterMeterCfg : ComponentCfgBase, Generic.IComponentCfg public class WaterMeterCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public IComponent GetComponent(IList<IComponent> components) { return new WaterMeter(this); }
public IComponentCfgCtrl GetControl() { return new WaterMeterCfgCtrl(); }
/// <summary> Procedure parameters </summary> /// <summary> Procedure parameters </summary>
[XmlIgnore] [XmlIgnore]
public ProcParams ProcParams; public ProcParams ProcParams;
@@ -1,5 +1,4 @@
using System.Collections.Generic; using TBF.BenchControl.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.WaterMeter namespace TBF.BenchControl.WaterMeter
{ {
@@ -7,30 +6,13 @@ namespace TBF.BenchControl.WaterMeter
{ {
public string ClassName { get { return "WaterMeter"; } } public string ClassName { get { return "WaterMeter"; } }
/// <summary>Max. number of components of this class in the system</summary> public void ResetStaticProperties() { WaterMeter.ResetStaticProperties(); }
public int MaxCount { get { return int.MaxValue; } }
public IComponentCfg DefaultConfig() { return new WaterMeterCfg(this); }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new WaterMeterCfg(this);
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new WaterMeterCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new WaterMeter((WaterMeterCfg)config);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{ {
return ComponentCfgBase.CreateFromDbEntity(typeof(WaterMeterCfg), component, this); return ComponentCfgBase.CreateFromDbEntity(typeof(WaterMeterCfg), component, this);
} }
public void ResetStaticProperties() { WaterMeter.ResetStaticProperties(); }
} }
} }
+6 -4
View File
@@ -224,8 +224,9 @@ namespace TBF
if (dr != DialogResult.OK) return; if (dr != DialogResult.OK) return;
IComponentFactory factory = selectComponentTypeDlg.SlctdCmpntFactory; IComponentFactory factory = selectComponentTypeDlg.SlctdCmpntFactory;
IComponentCfgCtrl cfgControl = factory.CreateCfgCtrl(); IComponentCfg config = factory.DefaultConfig();
cfgControl.Config = factory.DefaultConfig(cmpntEntities); IComponentCfgCtrl cfgControl = config.GetControl();
cfgControl.Config = config;
cfgControl.Config.ItemNr = listViewEx.Items.Count; cfgControl.Config.ItemNr = listViewEx.Items.Count;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(); ComponentParametersDlg cfgForm = new ComponentParametersDlg();
@@ -270,8 +271,9 @@ namespace TBF
ComponentParametersDlg cfgForm = new ComponentParametersDlg(); ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.TbfComponents = cmpntEntities; cfgForm.TbfComponents = cmpntEntities;
cfgForm.ComponentCfgCtrl = TbfComponents.CmpntFactoryFromClassName(((Entities.Component)lvi.Tag).ClassName).CreateCfgCtrl(); IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity((Entities.Component)lvi.Tag);
cfgForm.ComponentCfgCtrl.Config = TbfComponents.CmpntCfgFromCmpntEntity((Entities.Component)lvi.Tag); cfgForm.ComponentCfgCtrl.Config = cfg;
cfgForm.ComponentCfgCtrl = cfg.GetControl();
DialogResult dr = cfgForm.ShowDialog(); DialogResult dr = cfgForm.ShowDialog();
if (dr != DialogResult.OK) return; if (dr != DialogResult.OK) return;