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 _ISFFile = new Property(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 _DateOfTheTest = new Property(typeof(TestSetup).Namespace + ".TestSetup.DateOfTheTest", "", false); public string Description { get { return _Description.Value; } set { _Description.Value = value; } } private Property _Description = new Property(typeof(TestSetup).Namespace + ".TestSetup.Description", "", false); public string ExportFolder { get { return _ExportFolder.Value; } set { _ExportFolder.Value = value; } } private Property _ExportFolder = new Property(typeof(TestSetup).Namespace + ".TestSetup.ExportFolder", "", false); public Int32 ExportTypes { get { return _ExportTypes.Value; } set { _ExportTypes.Value = value; } } private Property _ExportTypes = new Property(typeof(TestSetup).Namespace + ".TestSetup.ExportFormats", new Int32(), false); public List Graphs { get { return _Graphs.Value; } set { _Graphs.Value = value; } } private Property> _Graphs = new Property>(typeof(TestSetup).Namespace + ".TestSetup.Graphs", new List(), true); public List Sensors { get { return _Sensors.Value; } set { _Sensors.Value = value; } } private Property> _Sensors = new Property>(typeof(TestSetup).Namespace + ".TestSetup.Sensors", new List(), true); public string LabName { get { return _LabName.Value; } set { _LabName.Value = value; } } private Property _LabName = new Property(typeof(TestSetup).Namespace + ".TestSetup.LabName", "", false); public string LaboratoryName { get { return _LaboratoryName.Value; } set { _LaboratoryName.Value = value; } } private Property _LaboratoryName = new Property(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryName", "", false); public string LaboratoryContactName { get { return _LaboratoryContactName.Value; } set { _LaboratoryContactName.Value = value; } } private Property _LaboratoryContactName = new Property(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactName", "", false); public string LaboratoryContactPhone { get { return _LaboratoryContactPhone.Value; } set { _LaboratoryContactPhone.Value = value; } } private Property _LaboratoryContactPhone = new Property(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactPhone", "", false); public string LaboratoryContactFax { get { return _LaboratoryContactFax.Value; } set { _LaboratoryContactFax.Value = value; } } private Property _LaboratoryContactFax = new Property(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactFax", "", false); public string LaboratoryContactEmail { get { return _LaboratoryContactEmail.Value; } set { _LaboratoryContactEmail.Value = value; } } private Property _LaboratoryContactEmail = new Property(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryContactEmail", "", false); public string LaboratoryTestReferenceNumber { get { return _LaboratoryTestReferenceNumber.Value; } set { _LaboratoryTestReferenceNumber.Value = value; } } private Property _LaboratoryTestReferenceNumber = new Property(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryTestReferenceNumber", "", false); public string LaboratoryProjectReferenceNumber { get { if (_LaboratoryProjectReferenceNumber.IsValueInitialized) { return _LaboratoryProjectReferenceNumber.Value; } else { return ""; } } set { _LaboratoryProjectReferenceNumber.Value = value; } } private Property _LaboratoryProjectReferenceNumber = new Property(typeof(TestSetup).Namespace + ".TestSetup.LaboratoryProjectReferenceNumber", "", false); public string CustName { get { return _CustName.Value; } set { _CustName.Value = value; } } private Property _CustName = new Property(typeof(TestSetup).Namespace + ".TestSetup.CustName", "", false); public string CustomerName { get { return _CustomerName.Value; } set { _CustomerName.Value = value; } } private Property _CustomerName = new Property(typeof(TestSetup).Namespace + ".TestSetup.CustomerName", "", false); public string CustomerTestReferenceNumber { get { return _CustomerTestReferenceNumber.Value; } set { _CustomerTestReferenceNumber.Value = value; } } private Property _CustomerTestReferenceNumber = new Property(typeof(TestSetup).Namespace + ".TestSetup.CustomerTestReferenceNumber", "", false); public string CustomerProjectReferenceNumber { get { return _CustomerProjectReferenceNumber.Value; } set { _CustomerProjectReferenceNumber.Value = value; } } private Property _CustomerProjectReferenceNumber = new Property(typeof(TestSetup).Namespace + ".TestSetup.CustomerProjectReferenceNumber", "", false); public string CustomerOrderNumber { get { return _CustomerOrderNumber.Value; } set { _CustomerOrderNumber.Value = value; } } private Property _CustomerOrderNumber = new Property(typeof(TestSetup).Namespace + ".TestSetup.CustomerOrderNumber", "", false); public string CustomerCostUnit { get { return _CustomerCostUnit.Value; } set { _CustomerCostUnit.Value = value; } } private Property _CustomerCostUnit = new Property(typeof(TestSetup).Namespace + ".TestSetup.CustomerCostUnit", "", false); public string TEName { get { if (_TEName.IsValueInitialized) { return _TEName.Value; } else { return ""; } } set { _TEName.Value = value; } } private Property _TEName = new Property(typeof(TestSetup).Namespace + ".TestSetup.TEName", "", false); public string TestEngineerName { get { return _TestEngineerName.Value; } set { _TestEngineerName.Value = value; } } private Property _TestEngineerName = new Property(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerName", "", false); public string TestEngineerPhone { get { return _TestEngineerPhone.Value; } set { _TestEngineerPhone.Value = value; } } private Property _TestEngineerPhone = new Property(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerPhone", "", false); public string TestEngineerFax { get { return _TestEngineerFax.Value; } set { _TestEngineerFax.Value = value; } } private Property _TestEngineerFax = new Property(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerFax", "", false); public string TestEngineerEmail { get { return _TestEngineerEmail.Value; } set { _TestEngineerEmail.Value = value; } } private Property _TestEngineerEmail = new Property(typeof(TestSetup).Namespace + ".TestSetup.TestEngineerEmail", "", false); public string Name { get { return _Name.Value; } set { _Name.Value = value; } } private Property _Name = new Property(typeof(TestSetup).Namespace + ".TestSetup.Name", "", false); public string NumberOfTestObjects { get { return _NumberOfTestObjects.Value; } set { _NumberOfTestObjects.Value = value; } } private Property _NumberOfTestObjects = new Property(typeof(TestSetup).Namespace + ".TestSetup.NumberOfTestObjects", "", false); public string NumberOfMedia { get { return _NumberOfMedia.Value; } set { _NumberOfMedia.Value = value; } } private Property _NumberOfMedia = new Property(typeof(TestSetup).Namespace + ".TestSetup.NumberOfMedia", "", false); public string ReferenceTemperature { get { return _ReferenceTemperature.Value; } set { _ReferenceTemperature.Value = value; } } private Property _ReferenceTemperature = new Property(typeof(TestSetup).Namespace + ".TestSetup.ReferenceTemperature", "", false); public string Regulation { get { return _Regulation.Value; } set { _Regulation.Value = value; } } private Property _Regulation = new Property(typeof(TestSetup).Namespace + ".TestSetup.Regulation", "", false); public string RelativeAirHumidity { get { return _RelativeAirHumidity.Value; } set { _RelativeAirHumidity.Value = value; } } private Property _RelativeAirHumidity = new Property(typeof(TestSetup).Namespace + ".TestSetup.RelativeAirHumidity", "", false); public string Subtype { get { return _Subtype.Value; } set { _Subtype.Value = value; } } private Property _Subtype = new Property(typeof(TestSetup).Namespace + ".TestSetup.Subtype", "", false); public string TestComment { get { return _TestComment.Value; } set { _TestComment.Value = value; } } private Property _TestComment = new Property(typeof(TestSetup).Namespace + ".TestSetup.TestComment", "", false); public List TestObjects { get { return _TestObjects.Value; } set { _TestObjects.Value = value; } } private Property> _TestObjects = new Property>(typeof(TestSetup).Namespace + ".TestSetup.TestObjects", new List(), true); public string Timestamp { get { return _Timestamp.Value; } set { _Timestamp.Value = value; } } private Property _Timestamp = new Property(typeof(TestSetup).Namespace + ".TestSetup.Timestamp", "", false); public string TypeOfTheTest { get { return _TypeOfTheTest.Value; } set { _TypeOfTheTest.Value = value; } } private Property _TypeOfTheTest = new Property(typeof(TestSetup).Namespace + ".TestSetup.TypeOfTheTest", "", false); public virtual string Version { get { return _Version.Value; } set { _Version.Value = value; } } private Property _Version = new Property(typeof(TestSetup).Namespace + ".TestSetup.Version", "", false); //Placeholder for all graph channels [System.Xml.Serialization.XmlIgnoreAttribute] public List Channels = new List(); //Placeholder for Single Channel Graphs [System.Xml.Serialization.XmlIgnoreAttribute] public List SingleChannelGraphs = new List(); [System.Xml.Serialization.XmlIgnoreAttribute] public IDictionary SortedGraphs = new Dictionary(); /* * 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(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); } } }