init
This commit is contained in:
468
Common/DTS.Common.Serialization/TestSetup/TestSetup.cs
Normal file
468
Common/DTS.Common.Serialization/TestSetup/TestSetup.cs
Normal file
@@ -0,0 +1,468 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DTS.Common.Enums.Sensors;
|
||||
using DTS.Common.Utilities;
|
||||
using DTS.Common.Utilities.DotNetProgrammingConstructs;
|
||||
|
||||
namespace DTS.Serialization
|
||||
{
|
||||
[Serializable]
|
||||
public partial class TestSetup : Exceptional
|
||||
{
|
||||
public TestSetup()
|
||||
{
|
||||
_dateOfTheTest.Value = null;
|
||||
_description.Value = null;
|
||||
_calibrationBehavior.Value = CalibrationBehaviors.NonLinearIfAvailable;
|
||||
_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 2.0 - 2019-05-17 added Upload/UploadFolder/UploadExportsOnly
|
||||
_version.Value = "2.0.0.0";
|
||||
_upload.Value = false;
|
||||
_uploadExportsOnly.Value = false;
|
||||
_uploadFolder.Value = "";
|
||||
}
|
||||
|
||||
private readonly Property<bool> _upload =
|
||||
new Property<bool>(typeof(TestSetup).Namespace + ".TestSetup.Upload", false, true);
|
||||
/// <summary>
|
||||
/// indicates whether the test setup was configured to upload when it was run
|
||||
/// 12874 export button, upload feature not displaying information
|
||||
/// </summary>
|
||||
public bool Upload
|
||||
{
|
||||
get => _upload.Value;
|
||||
set => _upload.Value = value;
|
||||
}
|
||||
|
||||
private readonly Property<string> _uploadFolder =
|
||||
new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.UploadFolder", "", true);
|
||||
/// <summary>
|
||||
/// stores the simple upload folder value set in edit test setup
|
||||
/// 12874 export button, upload feature not displaying information
|
||||
/// this is where the test setup was configured to upload when it was run
|
||||
/// this is overridden by an INI file if one is set
|
||||
/// </summary>
|
||||
public string UploadFolder
|
||||
{
|
||||
get => _uploadFolder.Value;
|
||||
set => _uploadFolder.Value = value;
|
||||
}
|
||||
|
||||
private readonly Property<bool> _uploadExportsOnly =
|
||||
new Property<bool>(typeof(TestSetup).Namespace + ".TestSetup.UploadExportsOnly", false, true);
|
||||
/// <summary>
|
||||
/// stores the simple upload folder value set in edit test setup
|
||||
/// 12874 export button, upload feature not displaying information
|
||||
/// this is where the test setup was configured to upload when it was run
|
||||
/// this is overridden by an INI file if one is set
|
||||
/// </summary>
|
||||
public bool UploadExportsOnly
|
||||
{
|
||||
get => _uploadExportsOnly.Value;
|
||||
set => _uploadExportsOnly.Value = value;
|
||||
}
|
||||
|
||||
|
||||
private readonly Property<string> _isfFile
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.ISFFile", "", true);
|
||||
public string ISFFile
|
||||
{
|
||||
get => _isfFile.Value;
|
||||
set => _isfFile.Value = value;
|
||||
}
|
||||
|
||||
public string DateOfTheTest
|
||||
{
|
||||
get => _dateOfTheTest.Value;
|
||||
set => _dateOfTheTest.Value = value;
|
||||
}
|
||||
private readonly Property<string> _dateOfTheTest
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.DateOfTheTest", "", false);
|
||||
|
||||
public string Description
|
||||
{
|
||||
get => _description.Value;
|
||||
set => _description.Value = value;
|
||||
}
|
||||
private readonly Property<string> _description
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Description", "", false);
|
||||
|
||||
public CalibrationBehaviors CalibrationBehavior
|
||||
{
|
||||
get => _calibrationBehavior.Value;
|
||||
set => _calibrationBehavior.Value = value;
|
||||
}
|
||||
private readonly Property<CalibrationBehaviors> _calibrationBehavior
|
||||
= new Property<CalibrationBehaviors>(typeof(TestSetup).Namespace + ".TestSetup.CalibrationBehavior", CalibrationBehaviors.NonLinearIfAvailable, false);
|
||||
|
||||
public string ExportFolder
|
||||
{
|
||||
get => _exportFolder.Value;
|
||||
set => _exportFolder.Value = value;
|
||||
}
|
||||
private readonly Property<string> _exportFolder
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.ExportFolder", "", false);
|
||||
|
||||
public Int32 ExportTypes
|
||||
{
|
||||
get => _exportTypes.Value;
|
||||
set => _exportTypes.Value = value;
|
||||
}
|
||||
private readonly Property<Int32> _exportTypes
|
||||
= new Property<Int32>(typeof(TestSetup).Namespace + ".TestSetup.ExportFormats", new Int32(), false);
|
||||
|
||||
public List<Graph> Graphs
|
||||
{
|
||||
get => _graphs.Value;
|
||||
set => _graphs.Value = value;
|
||||
}
|
||||
private readonly Property<List<Graph>> _graphs
|
||||
= new Property<List<Graph>>(typeof(TestSetup).Namespace + ".TestSetup.Graphs", new List<Graph>(), true);
|
||||
|
||||
public List<Sensor> Sensors
|
||||
{
|
||||
get => _sensors.Value;
|
||||
set => _sensors.Value = value;
|
||||
}
|
||||
private readonly Property<List<Sensor>> _sensors
|
||||
= new Property<List<Sensor>>(typeof(TestSetup).Namespace + ".TestSetup.Sensors", new List<Sensor>(), true);
|
||||
|
||||
public string LabName
|
||||
{
|
||||
get => _labName.Value;
|
||||
set => _labName.Value = value;
|
||||
}
|
||||
private readonly Property<string> _labName
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LabName", "", false);
|
||||
|
||||
public string LaboratoryName
|
||||
{
|
||||
get => _laboratoryName.Value;
|
||||
set => _laboratoryName.Value = value;
|
||||
}
|
||||
private readonly Property<string> _laboratoryName
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryName", "", false);
|
||||
|
||||
public string LaboratoryContactName
|
||||
{
|
||||
get => _laboratoryContactName.Value;
|
||||
set => _laboratoryContactName.Value = value;
|
||||
}
|
||||
private readonly Property<string> _laboratoryContactName
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactName", "", false);
|
||||
|
||||
public string LaboratoryContactPhone
|
||||
{
|
||||
get => _laboratoryContactPhone.Value;
|
||||
set => _laboratoryContactPhone.Value = value;
|
||||
}
|
||||
private readonly Property<string> _laboratoryContactPhone
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactPhone", "", false);
|
||||
|
||||
public string LaboratoryContactFax
|
||||
{
|
||||
get => _laboratoryContactFax.Value;
|
||||
set => _laboratoryContactFax.Value = value;
|
||||
}
|
||||
private readonly Property<string> _laboratoryContactFax
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactFax", "", false);
|
||||
|
||||
public string LaboratoryContactEmail
|
||||
{
|
||||
get => _laboratoryContactEmail.Value;
|
||||
set => _laboratoryContactEmail.Value = value;
|
||||
}
|
||||
private readonly Property<string> _laboratoryContactEmail
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactEmail", "", false);
|
||||
|
||||
public string LaboratoryTestReferenceNumber
|
||||
{
|
||||
get => _laboratoryTestReferenceNumber.Value;
|
||||
set => _laboratoryTestReferenceNumber.Value = value;
|
||||
}
|
||||
private readonly Property<string> _laboratoryTestReferenceNumber
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryTestReferenceNumber", "", false);
|
||||
|
||||
public string LaboratoryProjectReferenceNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_laboratoryProjectReferenceNumber.IsValueInitialized) { return _laboratoryProjectReferenceNumber.Value; }
|
||||
return "";
|
||||
}
|
||||
set => _laboratoryProjectReferenceNumber.Value = value;
|
||||
}
|
||||
private readonly Property<string> _laboratoryProjectReferenceNumber
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryProjectReferenceNumber", "", false);
|
||||
|
||||
public string CustName
|
||||
{
|
||||
get => _custName.Value;
|
||||
set => _custName.Value = value;
|
||||
}
|
||||
private readonly Property<string> _custName
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustName", "", false);
|
||||
|
||||
public string CustomerName
|
||||
{
|
||||
get => _customerName.Value;
|
||||
set => _customerName.Value = value;
|
||||
}
|
||||
private readonly Property<string> _customerName
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustomerName", "", false);
|
||||
|
||||
public string CustomerTestReferenceNumber
|
||||
{
|
||||
get => _customerTestReferenceNumber.Value;
|
||||
set => _customerTestReferenceNumber.Value = value;
|
||||
}
|
||||
private readonly Property<string> _customerTestReferenceNumber
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustomerTestReferenceNumber", "", false);
|
||||
|
||||
public string CustomerProjectReferenceNumber
|
||||
{
|
||||
get => _customerProjectReferenceNumber.Value;
|
||||
set => _customerProjectReferenceNumber.Value = value;
|
||||
}
|
||||
private readonly Property<string> _customerProjectReferenceNumber
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustomerProjectReferenceNumber", "", false);
|
||||
|
||||
public string CustomerOrderNumber
|
||||
{
|
||||
get => _customerOrderNumber.Value;
|
||||
set => _customerOrderNumber.Value = value;
|
||||
}
|
||||
private readonly Property<string> _customerOrderNumber
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustomerOrderNumber", "", false);
|
||||
|
||||
public string CustomerCostUnit
|
||||
{
|
||||
get => _customerCostUnit.Value;
|
||||
set => _customerCostUnit.Value = value;
|
||||
}
|
||||
private readonly Property<string> _customerCostUnit
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.CustomerCostUnit", "", false);
|
||||
|
||||
public string TEName
|
||||
{
|
||||
get => _teName.IsValueInitialized ? _teName.Value : "";
|
||||
set => _teName.Value = value;
|
||||
}
|
||||
private readonly Property<string> _teName
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TEName", "", false);
|
||||
|
||||
public string TestEngineerName
|
||||
{
|
||||
get => _testEngineerName.Value;
|
||||
set => _testEngineerName.Value = value;
|
||||
}
|
||||
private readonly Property<string> _testEngineerName
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerName", "", false);
|
||||
|
||||
public string TestEngineerPhone
|
||||
{
|
||||
get => _testEngineerPhone.Value;
|
||||
set => _testEngineerPhone.Value = value;
|
||||
}
|
||||
private readonly Property<string> _testEngineerPhone
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerPhone", "", false);
|
||||
|
||||
public string TestEngineerFax
|
||||
{
|
||||
get => _testEngineerFax.Value;
|
||||
set => _testEngineerFax.Value = value;
|
||||
}
|
||||
private readonly Property<string> _testEngineerFax
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerFax", "", false);
|
||||
|
||||
public string TestEngineerEmail
|
||||
{
|
||||
get => _testEngineerEmail.Value;
|
||||
set => _testEngineerEmail.Value = value;
|
||||
}
|
||||
private readonly Property<string> _testEngineerEmail
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerEmail", "", false);
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => _name.Value;
|
||||
set => _name.Value = value;
|
||||
}
|
||||
private readonly Property<string> _name
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Name", "", false);
|
||||
|
||||
public string NumberOfTestObjects
|
||||
{
|
||||
get => _numberOfTestObjects.Value;
|
||||
set => _numberOfTestObjects.Value = value;
|
||||
}
|
||||
private readonly Property<string> _numberOfTestObjects
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.NumberOfTestObjects", "", false);
|
||||
|
||||
public string NumberOfMedia
|
||||
{
|
||||
get => _numberOfMedia.Value;
|
||||
set => _numberOfMedia.Value = value;
|
||||
}
|
||||
private readonly Property<string> _numberOfMedia
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.NumberOfMedia", "", false);
|
||||
|
||||
public string ReferenceTemperature
|
||||
{
|
||||
get => _referenceTemperature.Value;
|
||||
set => _referenceTemperature.Value = value;
|
||||
}
|
||||
private readonly Property<string> _referenceTemperature
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.ReferenceTemperature", "", false);
|
||||
|
||||
public string Regulation
|
||||
{
|
||||
get => _regulation.Value;
|
||||
set => _regulation.Value = value;
|
||||
}
|
||||
private readonly Property<string> _regulation
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Regulation", "", false);
|
||||
|
||||
public string RelativeAirHumidity
|
||||
{
|
||||
get => _relativeAirHumidity.Value;
|
||||
set => _relativeAirHumidity.Value = value;
|
||||
}
|
||||
private readonly Property<string> _relativeAirHumidity
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.RelativeAirHumidity", "", false);
|
||||
|
||||
public string Subtype
|
||||
{
|
||||
get => _subtype.Value;
|
||||
set => _subtype.Value = value;
|
||||
}
|
||||
private readonly Property<string> _subtype
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Subtype", "", false);
|
||||
|
||||
public string TestComment
|
||||
{
|
||||
get => _testComment.Value;
|
||||
set => _testComment.Value = value;
|
||||
}
|
||||
private readonly Property<string> _testComment
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TestComment", "", false);
|
||||
|
||||
public List<ExtraProperty> ExtraProperties
|
||||
{
|
||||
get => _extraProperties.Value;
|
||||
set => _extraProperties.Value = value;
|
||||
}
|
||||
private readonly Property<List<ExtraProperty>> _extraProperties
|
||||
= new Property<List<ExtraProperty>>(typeof(TestSetup).Namespace + ".TestSetup.ExtraProperties", new List<ExtraProperty>(), true);
|
||||
|
||||
public List<TestObject> TestObjects
|
||||
{
|
||||
get => _testObjects.Value;
|
||||
set => _testObjects.Value = value;
|
||||
}
|
||||
private readonly Property<List<TestObject>> _testObjects
|
||||
= new Property<List<TestObject>>(typeof(TestSetup).Namespace + ".TestSetup.TestObjects", new List<TestObject>(), true);
|
||||
|
||||
public string Timestamp
|
||||
{
|
||||
get => _timestamp.Value;
|
||||
set => _timestamp.Value = value;
|
||||
}
|
||||
private readonly Property<string> _timestamp
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Timestamp", "", false);
|
||||
|
||||
public string TypeOfTheTest
|
||||
{
|
||||
get => _typeOfTheTest.Value;
|
||||
set => _typeOfTheTest.Value = value;
|
||||
}
|
||||
private readonly Property<string> _typeOfTheTest
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.TypeOfTheTest", "", false);
|
||||
|
||||
public virtual string Version
|
||||
{
|
||||
get => _version.Value;
|
||||
set => _version.Value = value;
|
||||
}
|
||||
private readonly Property<string> _version
|
||||
= new Property<string>(typeof(TestSetup).Namespace + ".TestSetup.Version", "", false);
|
||||
|
||||
//Placeholder for all graph channels
|
||||
[System.Xml.Serialization.XmlIgnore]
|
||||
public List<Graph.Channel> Channels = new List<Graph.Channel>();
|
||||
|
||||
//Placeholder for Single Channel Graphs
|
||||
[System.Xml.Serialization.XmlIgnore]
|
||||
public List<Graph> SingleChannelGraphs = new List<Graph>();
|
||||
|
||||
[System.Xml.Serialization.XmlIgnore]
|
||||
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(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user