Methods CreateDbEntity and CreateFromDbEntity moved from XyzCfg to ComponentCfgBase, factories modified accordingly.
This commit is contained in:
parent
8ef0cea1ff
commit
0ac7ba05d6
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
@ -12,44 +11,25 @@ namespace TBF.BenchControl.BenchId
|
||||
{
|
||||
public int TestBenchNr;
|
||||
|
||||
/// Parameterless constructor
|
||||
/// Parameterless constructor, sets default values
|
||||
public ComponentCfg()
|
||||
{
|
||||
}
|
||||
Name = "Bench-ID";
|
||||
ParentName = string.Empty;
|
||||
TestBenchNr = 1;
|
||||
}
|
||||
|
||||
public ComponentCfg(IComponentFactory factory, string name, int testBenchNr)
|
||||
: base(factory, name)
|
||||
public ComponentCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
TestBenchNr = testBenchNr;
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new ComponentCfg(Factory, Name, TestBenchNr);
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("TestBenchNr = {0}", TestBenchNr);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
ComponentCfg config = (ComponentCfg)(new XmlSerializer(typeof(ComponentCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, TestBenchNr={1}",
|
||||
Name,
|
||||
TestBenchNr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.BenchId
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new ComponentCfg(this, "Bench-ID", 1);
|
||||
return new ComponentCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.BenchId
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return ComponentCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(ComponentCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
|
||||
|
||||
@ -12,43 +12,23 @@ namespace TBF.BenchControl.Cameras.CameraRoi
|
||||
/// Parameterless constructor
|
||||
public CameraRoiCfg()
|
||||
{
|
||||
Name = "ROI";
|
||||
ParentName = "Idc";
|
||||
RoiNr = 1;
|
||||
}
|
||||
|
||||
/// Constructor
|
||||
public CameraRoiCfg(IComponentFactory factory, string name, string parentName, int roiNr)
|
||||
: base(factory, name, parentName)
|
||||
{
|
||||
this.RoiNr = roiNr;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new CameraRoiCfg(Factory, Name, ParentName, RoiNr);
|
||||
}
|
||||
public CameraRoiCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("roi{0}, parent={1}", RoiNr, ParentName);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr,
|
||||
DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
CameraRoiCfg config = (CameraRoiCfg)(new XmlSerializer(typeof(CameraRoiCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}, Parent={1}, Roi={2}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
RoiNr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ namespace TBF.BenchControl.Cameras.CameraRoi
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new CameraRoiCfg(this, "ROI", "", 1);
|
||||
return new CameraRoiCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -27,7 +27,7 @@ namespace TBF.BenchControl.Cameras.CameraRoi
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return CameraRoiCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(CameraRoiCfg), component, this);
|
||||
}
|
||||
|
||||
public bool HasProcedureParams { get { return true; } }
|
||||
|
||||
@ -14,44 +14,22 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
/// Parameterless constructor
|
||||
public IdcCameraCfg()
|
||||
{
|
||||
}
|
||||
Name = "Idc";
|
||||
ParentName = string.Empty;
|
||||
ComPortNr = 20;
|
||||
BaudRate = 57600;
|
||||
BrightnessCam = 0.5f;
|
||||
}
|
||||
|
||||
/// Constructor
|
||||
public IdcCameraCfg(IComponentFactory factory, string name, int comPortNr, int baudRate, float brightnessCam)
|
||||
: base(factory, name)
|
||||
{
|
||||
this.ComPortNr = comPortNr;
|
||||
this.BaudRate = baudRate;
|
||||
this.BrightnessCam = brightnessCam;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new IdcCameraCfg(Factory, Name, ComPortNr, BaudRate, BrightnessCam);
|
||||
}
|
||||
public IdcCameraCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("COM{0}, {1}Bd, brightness={2}%", ComPortNr, BaudRate, (int)(100.0f * BrightnessCam));
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
IdcCameraCfg config = (IdcCameraCfg)(new XmlSerializer(typeof(IdcCameraCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new IdcCameraCfg(this, "Idc", 20, 57600, 0.5f);
|
||||
return new IdcCameraCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -27,7 +27,7 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return IdcCameraCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(IdcCameraCfg), component, this);
|
||||
}
|
||||
|
||||
public bool HasProcedureParams { get { return false; } }
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl
|
||||
{
|
||||
@ -46,11 +49,19 @@ namespace TBF.BenchControl
|
||||
Entities.DebugMode debugLevel;
|
||||
|
||||
[XmlIgnore]
|
||||
public Entities.LogLevel LogLevel { get { return logLevel; } }
|
||||
public Entities.LogLevel LogLevel
|
||||
{
|
||||
get { return logLevel; }
|
||||
set { logLevel = value; }
|
||||
}
|
||||
Entities.LogLevel logLevel;
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<Entities.MeasurementCorrection> Corrections { get { return corrections; } }
|
||||
public IList<Entities.MeasurementCorrection> Corrections
|
||||
{
|
||||
get { return corrections; }
|
||||
set { corrections = value; }
|
||||
}
|
||||
IList<Entities.MeasurementCorrection> corrections;
|
||||
|
||||
protected ComponentCfgBase()
|
||||
@ -60,10 +71,15 @@ namespace TBF.BenchControl
|
||||
logLevel = Entities.LogLevel.Off;
|
||||
}
|
||||
|
||||
protected ComponentCfgBase(Generic.IComponentFactory factory, string name)
|
||||
protected ComponentCfgBase(Generic.IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.factory = factory;
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
protected ComponentCfgBase(Generic.IComponentFactory factory, string name)
|
||||
: this(factory)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@ -73,15 +89,31 @@ namespace TBF.BenchControl
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
protected void InitCfgBaseFromEntity(Entities.Component cmpntEntity, Generic.IComponentFactory factory)
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
name = cmpntEntity.Name;
|
||||
parentName = cmpntEntity.ParentName;
|
||||
itemNr = cmpntEntity.ItemNr;
|
||||
debugLevel = cmpntEntity.Mode;
|
||||
logLevel = cmpntEntity.Logging;
|
||||
corrections = cmpntEntity.Corrections;
|
||||
this.factory = factory;
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Type type, Entities.Component cmpntEntity, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(cmpntEntity.Parameters))
|
||||
{
|
||||
IComponentCfg config = (IComponentCfg)(new XmlSerializer(type)).Deserialize(reader);
|
||||
config.Name = cmpntEntity.Name;
|
||||
config.ParentName = cmpntEntity.ParentName;
|
||||
config.ItemNr = cmpntEntity.ItemNr;
|
||||
config.DebugLevel = cmpntEntity.Mode;
|
||||
config.LogLevel = cmpntEntity.Logging;
|
||||
config.Corrections = cmpntEntity.Corrections;
|
||||
config.Factory = factory;
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,49 +14,26 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
/// Parameterless constructor
|
||||
public EntryFormCfg()
|
||||
{
|
||||
Name = "DataEntryForm-Munich";
|
||||
ParentName = string.Empty;
|
||||
ProtocolTitle1 = "Protokoll Werkprüfung";
|
||||
ProtocolTitle2 = "Protokoll 2";
|
||||
ProtocolTitle3 = "Protokoll 3";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public EntryFormCfg(IComponentFactory factory, string name,
|
||||
string protocolTitle1, string protocolTitle2, string protocolTitle3)
|
||||
: base(factory, name)
|
||||
public EntryFormCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.ProtocolTitle1 = protocolTitle1;
|
||||
this.ProtocolTitle2 = protocolTitle2;
|
||||
this.ProtocolTitle3 = protocolTitle3;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new EntryFormCfg(Factory, Name, ProtocolTitle1, ProtocolTitle2, ProtocolTitle3);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
EntryFormCfg config = (EntryFormCfg)(new XmlSerializer(typeof(EntryFormCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
return string.Format("Name={0}, Protocol1={2}, Protocol2={3}, Protocol3={4}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ProtocolTitle1) ? "-" : ProtocolTitle1),
|
||||
(string.IsNullOrEmpty(ProtocolTitle2) ? "-" : ProtocolTitle2),
|
||||
(string.IsNullOrEmpty(ProtocolTitle3) ? "-" : ProtocolTitle3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new EntryFormCfg(this, "DataEntryForm-Munich", "Protokoll Werkprüfung", "Protokoll 2", "Protokoll 3");
|
||||
return new EntryFormCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.DataEntry.Munich
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return EntryFormCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
|
||||
|
||||
@ -11,52 +11,29 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
public string ProtocolTitle2;
|
||||
public string ProtocolTitle3;
|
||||
|
||||
/// Parameterless constructor
|
||||
public EntryFormCfg()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public EntryFormCfg(IComponentFactory factory, string name,
|
||||
string protocolTitle1, string protocolTitle2, string protocolTitle3)
|
||||
: base(factory, name)
|
||||
/// Parameterless constructor
|
||||
public EntryFormCfg()
|
||||
{
|
||||
this.ProtocolTitle1 = protocolTitle1;
|
||||
this.ProtocolTitle2 = protocolTitle2;
|
||||
this.ProtocolTitle3 = protocolTitle3;
|
||||
}
|
||||
Name = "DataEntryForm-3";
|
||||
ParentName = string.Empty;
|
||||
ProtocolTitle1 = "Protokoll Werkprüfung";
|
||||
ProtocolTitle2 = "Protokoll 2";
|
||||
ProtocolTitle3 = "Protokoll 3";
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new EntryFormCfg(Factory, Name, ProtocolTitle1, ProtocolTitle2, ProtocolTitle3);
|
||||
}
|
||||
public EntryFormCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
EntryFormCfg config = (EntryFormCfg)(new XmlSerializer(typeof(EntryFormCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Protocol1={2}, Protocol2={3}, Protocol3={4}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ProtocolTitle1) ? "-" : ProtocolTitle1),
|
||||
(string.IsNullOrEmpty(ProtocolTitle2) ? "-" : ProtocolTitle2),
|
||||
(string.IsNullOrEmpty(ProtocolTitle3) ? "-" : ProtocolTitle3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new EntryFormCfg(this, "DataEntryForm-3", "Protokoll Werkprüfung", "Protokoll 2", "Protokoll 3");
|
||||
return new EntryFormCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return EntryFormCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
|
||||
|
||||
@ -7,48 +7,22 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
{
|
||||
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
/// Parameterless constructor
|
||||
public EntryFormCfg()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public EntryFormCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
/// Parameterless constructor
|
||||
public EntryFormCfg()
|
||||
{
|
||||
}
|
||||
Name = "Generic-WM-States-Form";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new EntryFormCfg(Factory, Name);
|
||||
}
|
||||
public EntryFormCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
EntryFormCfg config = (EntryFormCfg)(new XmlSerializer(typeof(EntryFormCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new EntryFormCfg(this, "Generic-WM-States-Form");
|
||||
return new EntryFormCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return EntryFormCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(EntryFormCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { EntryForm.ResetStaticProperties(); }
|
||||
|
||||
@ -11,42 +11,20 @@ namespace TBF.BenchControl.Elde
|
||||
/// Parameterless constructor
|
||||
public ControlBoardCfg()
|
||||
{
|
||||
}
|
||||
/// Constructor
|
||||
public ControlBoardCfg(IComponentFactory factory, string name, int comPortNr)
|
||||
: base(factory, name)
|
||||
{
|
||||
this.ComPortNr = comPortNr;
|
||||
Name = "CB";
|
||||
ParentName = string.Empty;
|
||||
ComPortNr = 1;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new ControlBoardCfg(Factory, Name, ComPortNr);
|
||||
}
|
||||
public ControlBoardCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("COM{0}", ComPortNr);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component tbfComponent, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(tbfComponent.Parameters))
|
||||
{
|
||||
ControlBoardCfg config = (ControlBoardCfg)(new XmlSerializer(typeof(ControlBoardCfg))).Deserialize(reader);
|
||||
config.Name = tbfComponent.Name;
|
||||
config.InitCfgBaseFromEntity(tbfComponent, factory);
|
||||
return config;
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, ComPortNr={1}", Name, ComPortNr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new ControlBoardCfg(this, "CB", 1);
|
||||
return new ControlBoardCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return Elde.ControlBoardCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(Elde.ControlBoardCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { ControlBoardDev.ResetStaticProperties(); }
|
||||
|
||||
@ -11,41 +11,22 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
/// Parameterless constructor
|
||||
public DiverterCfg()
|
||||
{
|
||||
}
|
||||
/// Constructor
|
||||
public DiverterCfg(IComponentFactory factory, string name, string parentName, int bitPosition)
|
||||
: base(factory, name, parentName)
|
||||
{
|
||||
this.BitPosition = bitPosition;
|
||||
}
|
||||
Name = "Div";
|
||||
ParentName = "CB";
|
||||
BitPosition = 0;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new DiverterCfg(Factory, Name, ParentName, BitPosition);
|
||||
}
|
||||
public DiverterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("bit={0}", BitPosition);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
DiverterCfg config = (DiverterCfg)(new XmlSerializer(typeof(DiverterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}, Parent={1}, Bit={2}",
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
BitPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new DiverterCfg(this, "Diverter", "CB", 0);
|
||||
return new DiverterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -34,7 +34,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return DiverterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(DiverterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Diverter.ResetStaticProperties(); }
|
||||
|
||||
@ -10,44 +10,21 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
/// Parameterless constructor
|
||||
public RegisterReaderCfg()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Regulation valve configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="name">Regulation valve name</param>
|
||||
/// <param name="position">Position on the control board 1 .. nrWaterMeters</param>
|
||||
public RegisterReaderCfg(IComponentFactory factory, string name, string parentName)
|
||||
: base(factory, name, parentName)
|
||||
{
|
||||
}
|
||||
Name = "DummyRR";
|
||||
ParentName = "CB";
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new RegisterReaderCfg(Factory, Name, ParentName);
|
||||
}
|
||||
public RegisterReaderCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return "<nothing to configure>";
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
RegisterReaderCfg config = (RegisterReaderCfg)(new XmlSerializer(typeof(RegisterReaderCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}, Parent={1}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new RegisterReaderCfg(this, "Dummy", "CB");
|
||||
return new RegisterReaderCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -27,7 +27,7 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return RegisterReaderCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(RegisterReaderCfg), component, this);
|
||||
}
|
||||
|
||||
public bool HasProcedureParams { get { return true; } }
|
||||
|
||||
@ -7,55 +7,31 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
{
|
||||
public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
{
|
||||
public int Idx1; /// 1..5
|
||||
|
||||
public int Idx1; /// 1..5
|
||||
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
|
||||
|
||||
/// Parameterless constructor
|
||||
public FlowMeterCfg()
|
||||
{
|
||||
Name = "FlowMeter";
|
||||
ParentName = "CB";
|
||||
Idx1 = 1;
|
||||
NominalFlow = 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flow meter configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="name">Flow meter name</param>
|
||||
/// <param name="idx1">Position on the control board 1..5</param>
|
||||
public FlowMeterCfg(IComponentFactory factory, string name, string parentName, int idx1, float nominalFlow)
|
||||
: base(factory, name, parentName)
|
||||
public FlowMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
if (idx1 < 1 || idx1 > 5) throw new ArgumentOutOfRangeException("idx1");
|
||||
this.Idx1 = idx1;
|
||||
this.NominalFlow = nominalFlow;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new FlowMeterCfg(Factory, Name, ParentName, Idx1, NominalFlow);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("idx1={0}, nominalFlow={1}", Idx1, NominalFlow);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
FlowMeterCfg config = (FlowMeterCfg)(new XmlSerializer(typeof(FlowMeterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}, Parent={1}, Idx1={2}, NominalFlow={3}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Idx1,
|
||||
NominalFlow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new FlowMeterCfg(this, "FlowMeter", "CB", 1, 1);
|
||||
return new FlowMeterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -35,7 +35,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return FlowMeterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { FlowMeter.ResetStaticProperties(); }
|
||||
|
||||
@ -14,49 +14,27 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
/// Parameterless constructor
|
||||
public FlowMeterCfg()
|
||||
{
|
||||
}
|
||||
Name = "FlowMeterTwins";
|
||||
ParentName = "CB";
|
||||
NominalFlow = 1600;
|
||||
FlowMeter1 = string.Empty;
|
||||
FlowMeter2 = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flow meter configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="name">Flow meter name</param>
|
||||
/// <param name="parentName">Parent component name</param>
|
||||
/// <param name="nominalFlow">Nominal flow/param>
|
||||
public FlowMeterCfg(IComponentFactory factory, string name, string parentName, float nominalFlow, string flowMeter1, string flowMeter2)
|
||||
: base(factory, name, parentName)
|
||||
public FlowMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.NominalFlow = nominalFlow;
|
||||
this.FlowMeter1 = flowMeter1;
|
||||
this.FlowMeter2 = flowMeter2;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new FlowMeterCfg(Factory, Name, ParentName, NominalFlow, FlowMeter1, FlowMeter2);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("nominalFlow={0}, flowmeter#1={1}, flowmeter#2={2}", NominalFlow, FlowMeter1, FlowMeter2);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
FlowMeterCfg config = (FlowMeterCfg)(new XmlSerializer(typeof(FlowMeterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}, Parent={1}, NominalFlow={2}, Flowmeter1={3}, Flowmeter2={4}",
|
||||
Name,
|
||||
string.IsNullOrEmpty(ParentName) ? "-" : ParentName,
|
||||
NominalFlow,
|
||||
string.IsNullOrEmpty(FlowMeter1) ? "-" : FlowMeter1,
|
||||
string.IsNullOrEmpty(FlowMeter2) ? "-" : FlowMeter2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new FlowMeterCfg(this, "FlowMeterTwins", "CB", 1600, "---", "---");
|
||||
return new FlowMeterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -35,7 +35,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return FlowMeterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(FlowMeterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { FlowMeter.ResetStaticProperties(); }
|
||||
|
||||
@ -13,51 +13,25 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
/// Parameterless constructor
|
||||
public PressureMeterCfg()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Regulation valve configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="name">Regulation valve name</param>
|
||||
/// <param name="idx0">Position on the control board 0..3</param>
|
||||
/// <param name="dacValueClosed">0..1023</param>
|
||||
/// <param name="dacValueOpen">0..1023</param>
|
||||
public PressureMeterCfg(IComponentFactory factory, string name, string parentName, int idx0, byte rs485Address)
|
||||
: base(factory, name, parentName)
|
||||
Name = "PressureMeter";
|
||||
ParentName = "CB";
|
||||
Idx0 = 0;
|
||||
RS485Address = 99;
|
||||
}
|
||||
|
||||
public PressureMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
if (idx0 < 0 || idx0 > 3) throw new ArgumentOutOfRangeException("Index (0-based)");
|
||||
this.Idx0 = idx0;
|
||||
|
||||
if (rs485Address < 0 || rs485Address > 255) throw new ArgumentOutOfRangeException("RS485Address");
|
||||
this.RS485Address = rs485Address;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new PressureMeterCfg(Factory, Name, ParentName, Idx0, RS485Address);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("idx0={0}, RS485 address={1}", Idx0, RS485Address);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
PressureMeterCfg config = (PressureMeterCfg)(new XmlSerializer(typeof(PressureMeterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}, Parent={1}, Idx0={2}, Address={3}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Idx0,
|
||||
RS485Address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new PressureMeterCfg(this, "PressureMeter", "CB", 1, 99);
|
||||
return new PressureMeterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -34,7 +34,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return PressureMeterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(PressureMeterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { PressureMeter.ResetStaticProperties(); }
|
||||
|
||||
@ -12,44 +12,25 @@ namespace TBF.BenchControl.Elde.Pump
|
||||
/// Parameterless constructor
|
||||
public PumpCfg()
|
||||
{
|
||||
Name = "Pump";
|
||||
ParentName = "CB";
|
||||
BitPosition = 0;
|
||||
Delay = 1;
|
||||
}
|
||||
|
||||
/// Constructor
|
||||
public PumpCfg(IComponentFactory factory, string name, string parentName, int bitPosition, int delay)
|
||||
: base(factory, name, parentName)
|
||||
public PumpCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.BitPosition = bitPosition;
|
||||
this.Delay = delay;
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new PumpCfg(Factory, Name, ParentName, BitPosition, Delay);
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("bit={0}, delay={1}s", BitPosition, Delay);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
PumpCfg config = (PumpCfg)(new XmlSerializer(typeof(PumpCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Bit={2}, Delay={3}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
BitPosition,
|
||||
Delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.Pump
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new PumpCfg(this, "Pump", "CB", 0, 1);
|
||||
return new PumpCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -31,7 +31,7 @@ namespace TBF.BenchControl.Elde.Pump
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return PumpCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Pump.ResetStaticProperties(); }
|
||||
|
||||
@ -13,44 +13,27 @@ namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
/// Parameterless constructor
|
||||
public PumpCfg()
|
||||
{
|
||||
Name = "Pump";
|
||||
ParentName = "CB";
|
||||
BitPosition = 0;
|
||||
FMIndex = 0;
|
||||
Delay = 1;
|
||||
}
|
||||
/// Constructor
|
||||
public PumpCfg(IComponentFactory factory, string name, string parentName, int bitPosition, int fmIndex, int delay)
|
||||
: base(factory, name, parentName)
|
||||
}
|
||||
|
||||
public PumpCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.BitPosition = bitPosition;
|
||||
this.FMIndex = fmIndex;
|
||||
this.Delay = delay;
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new PumpCfg(Factory, Name, ParentName, BitPosition, FMIndex, Delay);
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("bit={0}, fmIdx={1}, delay={2}s", BitPosition, FMIndex, Delay);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
PumpCfg config = (PumpCfg)(new XmlSerializer(typeof(PumpCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Bit={2}, FMIndex={3}, Delay={4}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
BitPosition,
|
||||
FMIndex,
|
||||
Delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new PumpCfg(this, "Pump", "CB", 0, 0, 1);
|
||||
return new PumpCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -34,7 +34,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return PumpCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Pump.ResetStaticProperties(); }
|
||||
|
||||
@ -12,49 +12,23 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
/// Parameterless constructor
|
||||
public RegisterReaderCfg()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Regulation valve configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="name">Regulation valve name</param>
|
||||
/// <param name="position">Position on the control board 1 .. nrWaterMeters</param>
|
||||
public RegisterReaderCfg(IComponentFactory factory, string name, string parentName, int position)
|
||||
: base(factory, name, parentName)
|
||||
Name = "Sick";
|
||||
ParentName = "CB";
|
||||
Position = 1;
|
||||
}
|
||||
|
||||
public RegisterReaderCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
if (position < 1 || position >= 2 * Program.WMsCount)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("position");
|
||||
}
|
||||
this.Position = position;
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new RegisterReaderCfg(Factory, Name, ParentName, Position);
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("position={0}", Position);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
RegisterReaderCfg config = (RegisterReaderCfg)(new XmlSerializer(typeof(RegisterReaderCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Position={2}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new RegisterReaderCfg(this, "Sick", "CB", 1);
|
||||
return new RegisterReaderCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -27,7 +27,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return RegisterReaderCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(RegisterReaderCfg), component, this);
|
||||
}
|
||||
|
||||
public bool HasProcedureParams { get { return true; } }
|
||||
|
||||
@ -7,9 +7,6 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
{
|
||||
public class RegulValveCfg : ComponentCfgBase, IChildComponentCfg
|
||||
{
|
||||
///
|
||||
/// Stored parameters
|
||||
///
|
||||
public int Idx1; /// 1..7
|
||||
public int DacValueClosed; /// 0..1023
|
||||
public int DacValueOpen; /// 0..1023
|
||||
@ -26,63 +23,35 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Parameterless constructor
|
||||
public RegulValveCfg()
|
||||
{
|
||||
Name = "RegulationValve";
|
||||
ParentName = "CB";
|
||||
Idx1 = 1;
|
||||
DacValueClosed = 100;
|
||||
DacValueOpen = 500;
|
||||
PidCoef = 20;
|
||||
StableTimeMs = 500;
|
||||
StoredPositionReuse = false;
|
||||
FlowStableSec = 5;
|
||||
}
|
||||
/// <summary>
|
||||
/// Regulation valve configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="name">Regulation valve name</param>
|
||||
/// <param name="idx1">Position on the control board 0..7</param>
|
||||
/// <param name="dacValueClosed">0..1023</param>
|
||||
/// <param name="dacValueOpen">0..1023</param>
|
||||
/// <param name="pidCoef">1..100</param>
|
||||
public RegulValveCfg(IComponentFactory factory, string name, string parentName, int idx1, int dacValueClosed, int dacValueOpen, int pidCoef, int stableTimeMs, bool storedPositionReuse, int flowStableSec)
|
||||
: base(factory, name, parentName)
|
||||
}
|
||||
|
||||
public RegulValveCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
if (idx1 < 1 || idx1 > 7) throw new ArgumentOutOfRangeException("position");
|
||||
if (dacValueClosed < 0 || dacValueClosed > 1023) throw new ArgumentOutOfRangeException("dacValueOpen");
|
||||
if (dacValueOpen < 0 || dacValueOpen > 1023) throw new ArgumentOutOfRangeException("dacValueOpen");
|
||||
if (pidCoef < 1 || pidCoef > 100) throw new ArgumentOutOfRangeException("pidCoef");
|
||||
|
||||
this.Idx1 = idx1;
|
||||
this.DacValueClosed = dacValueClosed;
|
||||
this.DacValueOpen = dacValueOpen;
|
||||
this.PidCoef = pidCoef;
|
||||
this.StableTimeMs = stableTimeMs;
|
||||
this.StoredPositionReuse = storedPositionReuse;
|
||||
this.FlowStableSec = flowStableSec;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new RegulValveCfg(Factory, Name, ParentName, Idx1, DacValueClosed, DacValueOpen, PidCoef, StableTimeMs, StoredPositionReuse, FlowStableSec);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("idx1={0}, DA-closed={1}, DA-open={2}, PID={3}, stabT={4}ms, posReuse={5}, flowStable={6}s",
|
||||
Idx1, DacValueClosed, DacValueOpen, PidCoef, StableTimeMs, StoredPositionReuse, FlowStableSec);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
RegulValveCfg config = (RegulValveCfg)(new XmlSerializer(typeof(RegulValveCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}, Parent={1}, Idx1={2}, ADC-Closed={3}, ADC-Open={4}, PID={5}, StabTm={6}ms, PosReuse={7}, FlowStable={8}s",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Idx1,
|
||||
DacValueClosed,
|
||||
DacValueOpen,
|
||||
PidCoef,
|
||||
StableTimeMs,
|
||||
StoredPositionReuse,
|
||||
FlowStableSec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new RegulValveCfg(this, "RegulationValve", "CB", 1, 100, 500, 20, 500, false, 5);
|
||||
return new RegulValveCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -31,7 +31,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return RegulValveCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(RegulValveCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { RegulValve.ResetStaticProperties(); }
|
||||
|
||||
@ -18,61 +18,29 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
/// Parameterless constructor
|
||||
public TempMeterCfg()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Temperature meter configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="name">Temperature meter name</param>
|
||||
/// <param name="idx0">Position on the control board 0..7</param>
|
||||
/// <param name="a1">A1</param>
|
||||
/// <param name="a2">A2</param>
|
||||
/// <param name="a3">A3</param>
|
||||
/// <param name="a4">A4</param>
|
||||
/// <param name="a5">A5</param>
|
||||
public TempMeterCfg(IComponentFactory factory, string name, string parentName, int idx0, float a1, float a2, float a3, float a4, float a5)
|
||||
: base(factory, name, parentName)
|
||||
{
|
||||
if (idx0 < 0 || idx0 > 7) throw new ArgumentOutOfRangeException("position");
|
||||
this.Idx0 = idx0;
|
||||
Name = "TempMeter";
|
||||
ParentName = "CB";
|
||||
Idx0 = 0;
|
||||
A1 = 0;
|
||||
A2 = 0;
|
||||
A3 = 0;
|
||||
A4 = 0;
|
||||
A5 = 0;
|
||||
}
|
||||
|
||||
this.A1 = a1;
|
||||
this.A2 = a2;
|
||||
this.A3 = a3;
|
||||
this.A4 = a4;
|
||||
this.A5 = a5;
|
||||
}
|
||||
public TempMeterCfg(IComponentFactory factory, string name, string parentName, int index)
|
||||
: this(factory, name, parentName, index, -21.0116f, 0.0017727f, 0.00000000068422f, -7.40415E-16f, 0)
|
||||
{
|
||||
}
|
||||
public TempMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new TempMeterCfg(Factory, Name, ParentName, Idx0, A1, A2, A3, A4, A5);
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("idx0={0}, A1={1}, A2={2}, A3={3}, A4={4}, A5={5}", Idx0, A1, A2, A3, A4, A5);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
TempMeterCfg config = (TempMeterCfg)(new XmlSerializer(typeof(TempMeterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Idx0={2}, A1={3}, A2={4}, A3={5}, A4={6}, A5={7}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Idx0,
|
||||
A1, A2, A3, A4, A5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new TempMeterCfg(this, "TempMeter", "CB", 0);
|
||||
return new TempMeterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -31,7 +31,7 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return TempMeterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(TempMeterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); }
|
||||
|
||||
@ -6,9 +6,9 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
{
|
||||
public class ValveCfg : ComponentCfgBase, IChildComponentCfg
|
||||
{
|
||||
public int OpenCloseTime; /// Delay for SetValvesOp operations
|
||||
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
|
||||
///
|
||||
public string CoupledToName; /// Name of the coupled valve or null
|
||||
@ -20,65 +20,37 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
/// Parameterless constructor
|
||||
public ValveCfg()
|
||||
{
|
||||
OpenCloseTime = 1; /// Defaut value
|
||||
}
|
||||
/// Constructor 1
|
||||
public ValveCfg(IComponentFactory factory, string name, string parentName, int bitPosition, bool inverted, int openCloseTime,
|
||||
ValveCategory category, string coupledToName, bool invertCouple, int lagOpening, int lagClosing)
|
||||
: base(factory, name, parentName)
|
||||
{
|
||||
this.OpenCloseTime = openCloseTime;
|
||||
this.BitPosition = bitPosition;
|
||||
this.Category = category;
|
||||
this.Inverted = inverted;
|
||||
Name = "V";
|
||||
ParentName = "CB";
|
||||
BitPosition = 0;
|
||||
Category = ValveCategory.None;
|
||||
OpenCloseTime = 1;
|
||||
Inverted = false;
|
||||
CoupledToName = string.Empty;
|
||||
InvertCouple = false;
|
||||
LagOpening = 0;
|
||||
LagClosing = 0;
|
||||
}
|
||||
|
||||
this.CoupledToName = coupledToName;
|
||||
this.InvertCouple = invertCouple;
|
||||
this.LagOpening = lagOpening;
|
||||
this.LagClosing = lagClosing;
|
||||
}
|
||||
/// Constructor 2 without CoupledTo valve
|
||||
public ValveCfg(IComponentFactory factory, string name, string parentName, int bitPosition, bool inverted, int openCloseTime, ValveCategory category)
|
||||
: this(factory, name, parentName, bitPosition, inverted, openCloseTime, category, null, false, 0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new ValveCfg(Factory, Name, ParentName, BitPosition, Inverted, OpenCloseTime, Category, CoupledToName, InvertCouple, LagOpening, LagClosing);
|
||||
}
|
||||
public ValveCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("bit={0}, inv.={1}, delay={2}s, cat.={3}, coupledTo={4}, inv.Couple={5}, lagOpen={6}s, lagClose={7}s",
|
||||
return string.Format("Name={0}, Parent={1}, Bit={2}, Inv.={3}, Delay={4}s, Cat.={5}, CoupledTo={6}, Inv.Couple={7}, LagOpen={8}s, LagClose={9}s",
|
||||
Name,
|
||||
string.IsNullOrEmpty(ParentName) ? "-" : ParentName,
|
||||
BitPosition,
|
||||
(Inverted ? "yes" : "no"),
|
||||
Inverted ? "yes" : "no",
|
||||
OpenCloseTime,
|
||||
Category,
|
||||
(string.IsNullOrEmpty(CoupledToName) ? "---" : CoupledToName),
|
||||
(InvertCouple ? "yes" : "no"),
|
||||
string.IsNullOrEmpty(CoupledToName) ? "-" : CoupledToName,
|
||||
InvertCouple ? "yes" : "no",
|
||||
LagOpening,
|
||||
LagClosing);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr,
|
||||
DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
ValveCfg config = (ValveCfg)(new XmlSerializer(typeof(ValveCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new ValveCfg(this, "Valve", "CB", 0, false, 1, ValveCategory.None);
|
||||
return new ValveCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -31,7 +31,7 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return ValveCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(ValveCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Valve.ResetStaticProperties(); }
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.Generic
|
||||
/// <summary>
|
||||
/// Reference to the component factory (it is a singleton)
|
||||
/// </summary>
|
||||
IComponentFactory Factory { get; }
|
||||
IComponentFactory Factory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Component class / component type name
|
||||
@ -32,14 +32,13 @@ namespace TBF.BenchControl.Generic
|
||||
/// <summary>
|
||||
/// Log level, 0 = logging off
|
||||
/// </summary>
|
||||
Entities.LogLevel LogLevel { get; }
|
||||
Entities.LogLevel LogLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Measurement correction values
|
||||
/// </summary>
|
||||
IList<Entities.MeasurementCorrection> Corrections { get; }
|
||||
IList<Entities.MeasurementCorrection> Corrections { get; set; }
|
||||
|
||||
IComponentCfg Clone();
|
||||
TBF.Entities.Component CreateDbEntity();
|
||||
|
||||
string ToString(int i);
|
||||
|
||||
@ -17,46 +17,26 @@ namespace TBF.BenchControl.Greco
|
||||
/// Parameterless constructor
|
||||
public AmbientCfg()
|
||||
{
|
||||
}
|
||||
/// Constructor
|
||||
public AmbientCfg(IComponentFactory factory, string name, int comPortNr, int baudRate, Parity parity, int dataBits, StopBits stopBits, Handshake handshake)
|
||||
: base(factory, name)
|
||||
{
|
||||
this.ComPortNr = comPortNr;
|
||||
this.BaudRate = baudRate;
|
||||
this.Parity = parity;
|
||||
this.DataBits = dataBits;
|
||||
this.StopBits = stopBits;
|
||||
this.Handshake = handshake;
|
||||
}
|
||||
Name = "Ambient";
|
||||
ParentName = string.Empty;
|
||||
ComPortNr = 6;
|
||||
BaudRate = 19200;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
DataBits = 8;
|
||||
StopBits = System.IO.Ports.StopBits.One;
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new AmbientCfg(Factory, Name, ComPortNr, BaudRate, Parity, DataBits, StopBits, Handshake);
|
||||
}
|
||||
public AmbientCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("COM{0}, {1}Bd, {2}bits, parity={3}, stopBits={4}, {5}", ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
AmbientCfg config = (AmbientCfg)(new XmlSerializer(typeof(AmbientCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}, COM{1}, {2}Bd, {3}-bits, parity={4}, stopBits={5}, {6}",
|
||||
Name, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,8 +16,7 @@ namespace TBF.BenchControl.Greco
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new AmbientCfg(this, "Ambient", 6, 19200, System.IO.Ports.Parity.None, 8,
|
||||
System.IO.Ports.StopBits.One, System.IO.Ports.Handshake.None);
|
||||
return new AmbientCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +31,7 @@ namespace TBF.BenchControl.Greco
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return Greco.AmbientCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(AmbientCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Ambient.ResetStaticProperties(); }
|
||||
|
||||
@ -15,58 +15,34 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
public Handshake Handshake;
|
||||
public float Capacity; /// Max. water mass in 'kg' or volume in 'l'
|
||||
public float Empty; /// 'Empty' water mass in 'kg' or volume in 'l'
|
||||
public int EmptyTimeSec;
|
||||
public int EmptyTimeSec; /// s
|
||||
|
||||
/// Parameterless constructor
|
||||
public BalanceCfg()
|
||||
{
|
||||
Name = "Balance";
|
||||
ParentName = string.Empty;
|
||||
ComPortNr = 3;
|
||||
BaudRate = 2400;
|
||||
Parity = System.IO.Ports.Parity.Even;
|
||||
DataBits = 7;
|
||||
StopBits = System.IO.Ports.StopBits.One;
|
||||
Handshake = System.IO.Ports.Handshake.XOnXOff;
|
||||
Capacity = 200.0f;
|
||||
Empty = 20.0f;
|
||||
EmptyTimeSec = 180;
|
||||
}
|
||||
|
||||
/// Constructor
|
||||
public BalanceCfg(IComponentFactory factory, string name, int comPortNr, int baudRate, Parity parity, int dataBits, StopBits stopBits, Handshake handshake, float capacity, float empty, int emptyTimeSec)
|
||||
: base(factory, name)
|
||||
{
|
||||
this.ComPortNr = comPortNr;
|
||||
this.BaudRate = baudRate;
|
||||
this.Parity = parity;
|
||||
this.DataBits = dataBits;
|
||||
this.StopBits = stopBits;
|
||||
this.Handshake = handshake;
|
||||
this.Capacity = capacity;
|
||||
this.Empty = empty;
|
||||
this.EmptyTimeSec = emptyTimeSec;
|
||||
public BalanceCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new BalanceCfg(Factory, Name, ComPortNr, BaudRate, Parity, DataBits, StopBits, Handshake, Capacity, Empty, EmptyTimeSec);
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("COM{0}, {1}Bd, {2}bits, parity={3}, stopBits={4}, {5}, capacity={6}kg, empty={7}kg, emptyTime={8}s",
|
||||
ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake, Capacity, Empty, EmptyTimeSec);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
BalanceCfg config = (BalanceCfg)(new XmlSerializer(typeof(BalanceCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}, COM{1}, {2}Bd, {3}-bits, parity={4}, stopBits={5}, {6}, capacity={7}kg, empty={8}kg, emptyTime={9}s",
|
||||
Name, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake, Capacity, Empty, EmptyTimeSec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,9 +16,7 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new BalanceCfg(this, "Balance1", 3, 2400, System.IO.Ports.Parity.Even, 7,
|
||||
System.IO.Ports.StopBits.One, System.IO.Ports.Handshake.XOnXOff,
|
||||
200.0f, 20.0f, 180); // kg, kg, s
|
||||
return new BalanceCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -33,7 +31,7 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return MettlerToledo.BalanceCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(BalanceCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { BalanceDev.ResetStaticProperties(); }
|
||||
|
||||
@ -16,9 +16,7 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new BalanceCfg(this, "Balance1", 3, 2400, System.IO.Ports.Parity.Even, 7,
|
||||
System.IO.Ports.StopBits.One, System.IO.Ports.Handshake.XOnXOff,
|
||||
200.0f, 20.0f, 180); // kg, kg, s
|
||||
return new BalanceCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -33,7 +31,7 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return MettlerToledo.BalanceCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(BalanceCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { BalanceNewDev.ResetStaticProperties(); }
|
||||
|
||||
@ -10,45 +10,19 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
/// Parameterless constructor
|
||||
public PrinterCfg()
|
||||
{
|
||||
}
|
||||
Name = "BasicResultsPrinter";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basic results printer configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">BasicPrinter factory</param>
|
||||
/// <param name="name">Printer name</param>
|
||||
public PrinterCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
public PrinterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new PrinterCfg(Factory, Name);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
PrinterCfg config = (PrinterCfg)(new XmlSerializer(typeof(PrinterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new PrinterCfg(this, "BasicResultsPrinter");
|
||||
return new PrinterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return PrinterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
|
||||
|
||||
@ -7,48 +7,22 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
{
|
||||
public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
/// Parameterless constructor
|
||||
public PrinterCfg()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basic results printer configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">BasicPrinter factory</param>
|
||||
/// <param name="name">Printer name</param>
|
||||
public PrinterCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
/// Parameterless constructor
|
||||
public PrinterCfg()
|
||||
{
|
||||
}
|
||||
Name = "PrintedProtocol";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new PrinterCfg(Factory, Name);
|
||||
}
|
||||
public PrinterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
PrinterCfg config = (PrinterCfg)(new XmlSerializer(typeof(PrinterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new PrinterCfg(this, "PrintedProtocol");
|
||||
return new PrinterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -35,7 +35,7 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return PrinterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(PrinterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
|
||||
|
||||
@ -10,45 +10,19 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
/// Parameterless constructor
|
||||
public WriterCfg()
|
||||
{
|
||||
}
|
||||
Name = "BasicResultsWriter";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basic results printer configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">BasicPrinter factory</param>
|
||||
/// <param name="name">Printer name</param>
|
||||
public WriterCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
public WriterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new WriterCfg(Factory, Name);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
WriterCfg config = (WriterCfg)(new XmlSerializer(typeof(WriterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new WriterCfg(this, "BasicResultsWriter");
|
||||
return new WriterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.ResultsWriters.Basic
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return WriterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(WriterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { Writer.ResetStaticProperties(); }
|
||||
|
||||
@ -5,7 +5,7 @@ namespace TBF.BenchControl
|
||||
{
|
||||
public static class TbfComponents
|
||||
{
|
||||
public static IList<IComponentFactory> Factories;
|
||||
public readonly static IList<IComponentFactory> Factories;
|
||||
|
||||
static TbfComponents()
|
||||
{
|
||||
|
||||
@ -10,45 +10,19 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
|
||||
/// Parameterless constructor
|
||||
public RoiDetectionCfg()
|
||||
{
|
||||
}
|
||||
Name = "RoiDetection";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public RoiDetectionCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
public RoiDetectionCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new RoiDetectionCfg(Factory, Name);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("ROI-s detection {0}", Name);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
RoiDetectionCfg config = (RoiDetectionCfg)(new XmlSerializer(typeof(RoiDetectionCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new RoiDetectionCfg(this, "RoiDetection");
|
||||
return new RoiDetectionCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return RoiDetectionCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(RoiDetectionCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { RoiDetection.ResetStaticProperties(); }
|
||||
|
||||
@ -10,45 +10,19 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
/// Parameterless constructor
|
||||
public TestMethodCfg()
|
||||
{
|
||||
}
|
||||
Name = "CombinedMeters";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public TestMethodCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
public TestMethodCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new TestMethodCfg(Factory, Name);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
TestMethodCfg config = (TestMethodCfg)(new XmlSerializer(typeof(TestMethodCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new TestMethodCfg(this, "CombinedMeters");
|
||||
return new TestMethodCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -33,7 +33,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return TestMethodCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
|
||||
|
||||
@ -10,45 +10,19 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
/// Parameterless constructor
|
||||
public TestMethodCfg()
|
||||
{
|
||||
}
|
||||
Name = "CombinedWithDetection";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public TestMethodCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
public TestMethodCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new TestMethodCfg(Factory, Name);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
TestMethodCfg config = (TestMethodCfg)(new XmlSerializer(typeof(TestMethodCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new TestMethodCfg(this, "CombinedWithDetection");
|
||||
return new TestMethodCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -28,7 +28,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return TestMethodCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
|
||||
}
|
||||
|
||||
public bool HasProcedureParams { get { return false; } }
|
||||
|
||||
@ -10,45 +10,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
/// Parameterless constructor
|
||||
public TestMethodCfg()
|
||||
{
|
||||
}
|
||||
Name = "FixedStartMassCollection";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public TestMethodCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
public TestMethodCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new TestMethodCfg(Factory, Name);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
TestMethodCfg config = (TestMethodCfg)(new XmlSerializer(typeof(TestMethodCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new TestMethodCfg(this, "FixedStartMassCollection");
|
||||
return new TestMethodCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return TestMethodCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
|
||||
|
||||
@ -10,45 +10,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
/// Parameterless constructor
|
||||
public TestMethodCfg()
|
||||
{
|
||||
}
|
||||
Name = "FlyingStart";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public TestMethodCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
public TestMethodCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new TestMethodCfg(Factory, Name);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
TestMethodCfg config = (TestMethodCfg)(new XmlSerializer(typeof(TestMethodCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new TestMethodCfg(this, "FlyingStart");
|
||||
return new TestMethodCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return TestMethodCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
|
||||
|
||||
@ -8,47 +8,22 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
||||
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
/// Parameterless constructor
|
||||
public TestMethodCfg()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public TestMethodCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
/// Parameterless constructor
|
||||
public TestMethodCfg()
|
||||
{
|
||||
}
|
||||
Name = "FlyingStartCollection";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new TestMethodCfg(Factory, Name);
|
||||
}
|
||||
public TestMethodCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
TestMethodCfg config = (TestMethodCfg)(new XmlSerializer(typeof(TestMethodCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new TestMethodCfg(this, "FlyingStartCollection");
|
||||
return new TestMethodCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return TestMethodCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
|
||||
|
||||
@ -7,48 +7,22 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
{
|
||||
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
/// Parameterless constructor
|
||||
public TestMethodCfg()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public TestMethodCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
/// Parameterless constructor
|
||||
public TestMethodCfg()
|
||||
{
|
||||
}
|
||||
Name = "ReferenceFlowmeterCalibration";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new TestMethodCfg(Factory, Name);
|
||||
}
|
||||
public TestMethodCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
TestMethodCfg config = (TestMethodCfg)(new XmlSerializer(typeof(TestMethodCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new TestMethodCfg(this, "ReferenceFlowmeterCalibration");
|
||||
return new TestMethodCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return TestMethodCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
|
||||
|
||||
@ -11,45 +11,19 @@ namespace TBF.BenchControl.WaterMeter
|
||||
/// Parameterless constructor
|
||||
public WaterMeterCfg()
|
||||
{
|
||||
}
|
||||
Name = "WaterMeter";
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data entry form configuration parameters
|
||||
/// </summary>
|
||||
/// <param name="factory">Data entry form factory</param>
|
||||
/// <param name="name">Component name</param>
|
||||
public WaterMeterCfg(IComponentFactory factory, string name)
|
||||
: base(factory, name)
|
||||
public WaterMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new WaterMeterCfg(Factory, Name);
|
||||
}
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format(Strings.nothing_to_configure);
|
||||
}
|
||||
|
||||
public TBF.Entities.Component CreateDbEntity()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
(new XmlSerializer(GetType())).Serialize(writer, this);
|
||||
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
||||
{
|
||||
using (var reader = new StringReader(component.Parameters))
|
||||
{
|
||||
WaterMeterCfg config = (WaterMeterCfg)(new XmlSerializer(typeof(WaterMeterCfg))).Deserialize(reader);
|
||||
config.InitCfgBaseFromEntity(component, factory);
|
||||
return config;
|
||||
}
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ namespace TBF.BenchControl.WaterMeter
|
||||
|
||||
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
|
||||
{
|
||||
return new WaterMeterCfg(this, "WaterMeter");
|
||||
return new WaterMeterCfg(this);
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
@ -35,7 +35,7 @@ namespace TBF.BenchControl.WaterMeter
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
|
||||
{
|
||||
return WaterMeterCfg.CreateFromDbEntity(component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(WaterMeterCfg), component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { WaterMeter.ResetStaticProperties(); }
|
||||
|
||||
@ -229,7 +229,7 @@ namespace TBF
|
||||
session.SaveOrUpdate(admin);
|
||||
|
||||
/// Create the control board component
|
||||
var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory(), "CB", 1)).CreateDbEntity();
|
||||
var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
|
||||
session.SaveOrUpdate(cmpnt);
|
||||
|
||||
transaction.Commit();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user