55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Xml.Serialization;
|
|
using TBF.BenchControl.Generic;
|
|
|
|
namespace TBF.BenchControl.TestMethods.CameraRoiDetection
|
|
{
|
|
public class RoiDetectionCfg : ComponentCfgBase, Generic.IComponentCfg
|
|
{
|
|
/// Parameterless constructor
|
|
public RoiDetectionCfg()
|
|
{
|
|
}
|
|
|
|
/// <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 IComponentCfg Clone()
|
|
{
|
|
return new RoiDetectionCfg(Factory, Name);
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|