421 lines
16 KiB
C#
421 lines
16 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using DTS.Utilities;
|
|
using DTS.Utilities.DotNetProgrammingConstructs;
|
|
|
|
namespace DTS.Serialization
|
|
{
|
|
[Serializable]
|
|
public partial class TestSetup : Exceptional
|
|
{
|
|
public TestSetup()
|
|
{
|
|
_DateOfTheTest.Value = null;
|
|
_Description.Value = null;
|
|
_ExportFolder.Value = null;
|
|
_ExportTypes.Value = 0;
|
|
|
|
_LabName.Value = null;
|
|
_LaboratoryName.Value = null;
|
|
_LaboratoryContactName.Value = null;
|
|
_LaboratoryContactPhone.Value = null;
|
|
_LaboratoryContactFax.Value = null;
|
|
_LaboratoryContactEmail.Value = null;
|
|
_LaboratoryTestReferenceNumber.Value = null;
|
|
|
|
_CustName.Value = null;
|
|
_CustomerName.Value = null;
|
|
_CustomerTestReferenceNumber.Value = null;
|
|
_CustomerProjectReferenceNumber.Value = null;
|
|
_CustomerOrderNumber.Value = null;
|
|
_CustomerCostUnit.Value = null;
|
|
_TestEngineerName.Value = null;
|
|
_TestEngineerPhone.Value = null;
|
|
_TestEngineerFax.Value = null;
|
|
_TestEngineerEmail.Value = null;
|
|
|
|
_Name.Value = null;
|
|
_NumberOfMedia.Value = null;
|
|
_NumberOfTestObjects.Value = null;
|
|
_TestComment.Value = null;
|
|
_TypeOfTheTest.Value = null;
|
|
_ReferenceTemperature.Value = null;
|
|
_RelativeAirHumidity.Value = null;
|
|
_Regulation.Value = null;
|
|
_Subtype.Value = null;
|
|
_DateOfTheTest.Value = null;
|
|
|
|
_Timestamp.Value = null;
|
|
_Version.Value = "1.0.0.0";
|
|
|
|
}
|
|
|
|
|
|
private Property<string> _ISFFile
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.ISFFile", "", true);
|
|
public string ISFFile
|
|
{
|
|
get { return _ISFFile.Value; }
|
|
set { _ISFFile.Value = value; }
|
|
}
|
|
|
|
public string DateOfTheTest
|
|
{
|
|
get { return _DateOfTheTest.Value; }
|
|
set { _DateOfTheTest.Value = value; }
|
|
}
|
|
private Property<string> _DateOfTheTest
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.DateOfTheTest", "", false);
|
|
|
|
public string Description
|
|
{
|
|
get { return _Description.Value; }
|
|
set { _Description.Value = value; }
|
|
}
|
|
private Property<string> _Description
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Description", "", false);
|
|
|
|
public string ExportFolder
|
|
{
|
|
get { return _ExportFolder.Value; }
|
|
set { _ExportFolder.Value = value; }
|
|
}
|
|
private Property<string> _ExportFolder
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.ExportFolder", "", false);
|
|
|
|
public Int32 ExportTypes
|
|
{
|
|
get { return _ExportTypes.Value; }
|
|
set { _ExportTypes.Value = value; }
|
|
}
|
|
private Property<Int32> _ExportTypes
|
|
= new Property<Int32>(typeof(TestSetup).Namespace + ".TestSetup.ExportFormats", new Int32(), false);
|
|
|
|
public List<Graph> Graphs
|
|
{
|
|
get { return _Graphs.Value; }
|
|
set { _Graphs.Value = value; }
|
|
}
|
|
private Property<List<Graph>> _Graphs
|
|
= new Property<List<Graph>>(typeof(TestSetup).Namespace + ".TestSetup.Graphs", new List<TestSetup.Graph>(), true);
|
|
|
|
public List<Sensor> Sensors
|
|
{
|
|
get { return _Sensors.Value; }
|
|
set { _Sensors.Value = value; }
|
|
}
|
|
private Property<List<Sensor>> _Sensors
|
|
= new Property<List<Sensor>>(typeof(TestSetup).Namespace + ".TestSetup.Sensors", new List<TestSetup.Sensor>(), true);
|
|
|
|
public string LabName
|
|
{
|
|
get { return _LabName.Value; }
|
|
set { _LabName.Value = value; }
|
|
}
|
|
private Property<string> _LabName
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LabName", "", false);
|
|
|
|
public string LaboratoryName
|
|
{
|
|
get { return _LaboratoryName.Value; }
|
|
set { _LaboratoryName.Value = value; }
|
|
}
|
|
private Property<string> _LaboratoryName
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryName", "", false);
|
|
|
|
public string LaboratoryContactName
|
|
{
|
|
get { return _LaboratoryContactName.Value; }
|
|
set { _LaboratoryContactName.Value = value; }
|
|
}
|
|
private Property<string> _LaboratoryContactName
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactName", "", false);
|
|
|
|
public string LaboratoryContactPhone
|
|
{
|
|
get { return _LaboratoryContactPhone.Value; }
|
|
set { _LaboratoryContactPhone.Value = value; }
|
|
}
|
|
private Property<string> _LaboratoryContactPhone
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactPhone", "", false);
|
|
|
|
public string LaboratoryContactFax
|
|
{
|
|
get { return _LaboratoryContactFax.Value; }
|
|
set { _LaboratoryContactFax.Value = value; }
|
|
}
|
|
private Property<string> _LaboratoryContactFax
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactFax", "", false);
|
|
|
|
public string LaboratoryContactEmail
|
|
{
|
|
get { return _LaboratoryContactEmail.Value; }
|
|
set { _LaboratoryContactEmail.Value = value; }
|
|
}
|
|
private Property<string> _LaboratoryContactEmail
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactEmail", "", false);
|
|
|
|
public string LaboratoryTestReferenceNumber
|
|
{
|
|
get { return _LaboratoryTestReferenceNumber.Value; }
|
|
set { _LaboratoryTestReferenceNumber.Value = value; }
|
|
}
|
|
private Property<string> _LaboratoryTestReferenceNumber
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryTestReferenceNumber", "", false);
|
|
|
|
public string LaboratoryProjectReferenceNumber
|
|
{
|
|
get
|
|
{
|
|
if (_LaboratoryProjectReferenceNumber.IsValueInitialized) { return _LaboratoryProjectReferenceNumber.Value; }
|
|
else { return ""; }
|
|
}
|
|
set { _LaboratoryProjectReferenceNumber.Value = value; }
|
|
}
|
|
private Property<string> _LaboratoryProjectReferenceNumber
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryProjectReferenceNumber", "", false);
|
|
|
|
public string CustName
|
|
{
|
|
get { return _CustName.Value; }
|
|
set { _CustName.Value = value; }
|
|
}
|
|
private Property<string> _CustName
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustName", "", false);
|
|
|
|
public string CustomerName
|
|
{
|
|
get { return _CustomerName.Value; }
|
|
set { _CustomerName.Value = value; }
|
|
}
|
|
private Property<string> _CustomerName
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustomerName", "", false);
|
|
|
|
public string CustomerTestReferenceNumber
|
|
{
|
|
get { return _CustomerTestReferenceNumber.Value; }
|
|
set { _CustomerTestReferenceNumber.Value = value; }
|
|
}
|
|
private Property<string> _CustomerTestReferenceNumber
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustomerTestReferenceNumber", "", false);
|
|
|
|
public string CustomerProjectReferenceNumber
|
|
{
|
|
get { return _CustomerProjectReferenceNumber.Value; }
|
|
set { _CustomerProjectReferenceNumber.Value = value; }
|
|
}
|
|
private Property<string> _CustomerProjectReferenceNumber
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustomerProjectReferenceNumber", "", false);
|
|
|
|
public string CustomerOrderNumber
|
|
{
|
|
get { return _CustomerOrderNumber.Value; }
|
|
set { _CustomerOrderNumber.Value = value; }
|
|
}
|
|
private Property<string> _CustomerOrderNumber
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustomerOrderNumber", "", false);
|
|
|
|
public string CustomerCostUnit
|
|
{
|
|
get { return _CustomerCostUnit.Value; }
|
|
set { _CustomerCostUnit.Value = value; }
|
|
}
|
|
private Property<string> _CustomerCostUnit
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustomerCostUnit", "", false);
|
|
|
|
public string TEName
|
|
{
|
|
get
|
|
{
|
|
if (_TEName.IsValueInitialized)
|
|
{
|
|
return _TEName.Value;
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
set { _TEName.Value = value; }
|
|
}
|
|
private Property<string> _TEName
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TEName", "", false);
|
|
|
|
public string TestEngineerName
|
|
{
|
|
get { return _TestEngineerName.Value; }
|
|
set { _TestEngineerName.Value = value; }
|
|
}
|
|
private Property<string> _TestEngineerName
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerName", "", false);
|
|
|
|
public string TestEngineerPhone
|
|
{
|
|
get { return _TestEngineerPhone.Value; }
|
|
set { _TestEngineerPhone.Value = value; }
|
|
}
|
|
private Property<string> _TestEngineerPhone
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerPhone", "", false);
|
|
|
|
public string TestEngineerFax
|
|
{
|
|
get { return _TestEngineerFax.Value; }
|
|
set { _TestEngineerFax.Value = value; }
|
|
}
|
|
private Property<string> _TestEngineerFax
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerFax", "", false);
|
|
|
|
public string TestEngineerEmail
|
|
{
|
|
get { return _TestEngineerEmail.Value; }
|
|
set { _TestEngineerEmail.Value = value; }
|
|
}
|
|
private Property<string> _TestEngineerEmail
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerEmail", "", false);
|
|
|
|
public string Name
|
|
{
|
|
get { return _Name.Value; }
|
|
set { _Name.Value = value; }
|
|
}
|
|
private Property<string> _Name
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Name", "", false);
|
|
|
|
public string NumberOfTestObjects
|
|
{
|
|
get { return _NumberOfTestObjects.Value; }
|
|
set { _NumberOfTestObjects.Value = value; }
|
|
}
|
|
private Property<string> _NumberOfTestObjects
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.NumberOfTestObjects", "", false);
|
|
|
|
public string NumberOfMedia
|
|
{
|
|
get { return _NumberOfMedia.Value; }
|
|
set { _NumberOfMedia.Value = value; }
|
|
}
|
|
private Property<string> _NumberOfMedia
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.NumberOfMedia", "", false);
|
|
|
|
public string ReferenceTemperature
|
|
{
|
|
get { return _ReferenceTemperature.Value; }
|
|
set { _ReferenceTemperature.Value = value; }
|
|
}
|
|
private Property<string> _ReferenceTemperature
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.ReferenceTemperature", "", false);
|
|
|
|
public string Regulation
|
|
{
|
|
get { return _Regulation.Value; }
|
|
set { _Regulation.Value = value; }
|
|
}
|
|
private Property<string> _Regulation
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Regulation", "", false);
|
|
|
|
public string RelativeAirHumidity
|
|
{
|
|
get { return _RelativeAirHumidity.Value; }
|
|
set { _RelativeAirHumidity.Value = value; }
|
|
}
|
|
private Property<string> _RelativeAirHumidity
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.RelativeAirHumidity", "", false);
|
|
|
|
public string Subtype
|
|
{
|
|
get { return _Subtype.Value; }
|
|
set { _Subtype.Value = value; }
|
|
}
|
|
private Property<string> _Subtype
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Subtype", "", false);
|
|
|
|
public string TestComment
|
|
{
|
|
get { return _TestComment.Value; }
|
|
set { _TestComment.Value = value; }
|
|
}
|
|
private Property<string> _TestComment
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TestComment", "", false);
|
|
|
|
public List<TestObject> TestObjects
|
|
{
|
|
get { return _TestObjects.Value; }
|
|
set { _TestObjects.Value = value; }
|
|
}
|
|
private Property<List<TestObject>> _TestObjects
|
|
= new Property<List<TestObject>>(typeof(TestSetup).Namespace + ".TestSetup.TestObjects", new List<TestSetup.TestObject>(), true);
|
|
|
|
public string Timestamp
|
|
{
|
|
get { return _Timestamp.Value; }
|
|
set { _Timestamp.Value = value; }
|
|
}
|
|
private Property<string> _Timestamp
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Timestamp", "", false);
|
|
|
|
public string TypeOfTheTest
|
|
{
|
|
get { return _TypeOfTheTest.Value; }
|
|
set { _TypeOfTheTest.Value = value; }
|
|
}
|
|
private Property<string> _TypeOfTheTest
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TypeOfTheTest", "", false);
|
|
|
|
public virtual string Version
|
|
{
|
|
get { return _Version.Value; }
|
|
set { _Version.Value = value; }
|
|
}
|
|
private Property<string> _Version
|
|
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Version", "", false);
|
|
|
|
//Placeholder for all graph channels
|
|
[System.Xml.Serialization.XmlIgnoreAttribute]
|
|
public List<Graph.Channel> Channels = new List<Graph.Channel>();
|
|
|
|
//Placeholder for Single Channel Graphs
|
|
[System.Xml.Serialization.XmlIgnoreAttribute]
|
|
public List<Graph> SingleChannelGraphs = new List<Graph>();
|
|
|
|
[System.Xml.Serialization.XmlIgnoreAttribute]
|
|
public IDictionary<Guid, Graph> SortedGraphs = new Dictionary<Guid, Graph>();
|
|
|
|
/*
|
|
* Display listing of graphs is a little funny:
|
|
* First come defined multi-channel graphs in the order that they are listed in the .dts file.
|
|
* Next come the single channel files that are created when a dts file is read in sorted by display order
|
|
* Finally come all the calculated channels, sorted in display order.
|
|
*/
|
|
|
|
public void SortGraphs()
|
|
{
|
|
SortedGraphs.Clear();
|
|
|
|
foreach (var g in Graphs)
|
|
{
|
|
SortedGraphs.Add(g.Identifier, g);
|
|
}
|
|
|
|
//All of the multi channel graphs are in the dictionary in the correct order, now sort the single channel graphs.
|
|
SingleChannelGraphs.Sort(new Comparison<Graph>(GraphDisplayOrderComparer));
|
|
|
|
//Add them to the dictionary
|
|
foreach (var g in SingleChannelGraphs)
|
|
{
|
|
SortedGraphs.Add(g.Identifier, g);
|
|
}
|
|
}
|
|
|
|
private int GraphDisplayOrderComparer(Graph a, Graph b)
|
|
{
|
|
if (a == b) { return 0; }
|
|
if (null == a) { return -1; }
|
|
if (null == b) { return 1; }
|
|
|
|
return a.FirstTestChannel.AbsoluteDisplayOrder.CompareTo(b.FirstTestChannel.AbsoluteDisplayOrder);
|
|
}
|
|
}
|
|
}
|