Files
2025-10-24 15:18:11 -07:00

140 lines
3.6 KiB
C#

using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Xml.Serialization;
namespace Raytheon.Common.PdelWriter.Utilities
{
[XmlType("ASICTestExecutive-UutTestConfiguration")]
public class TestResultList
{
[XmlArray("TestResultList")]
[XmlArrayItem("TestResult")]
public List<TestResult> List { get; set; }
public TestResultList()
{
List = new List<TestResult>();
}
}
public class TestResult : INotifyPropertyChanged
{
[XmlElement("PCode")]
public string PCode { get; set; }
[XmlElement("TestName")]
public string TestName { get; set; }
[XmlElement("UnitOfMeasure")]
public string UnitOfMeasure { get; set; }
[XmlIgnore]
public string MethodName { get; set; }
[XmlIgnore]
private string messages;
[XmlIgnore]
public string Messages
{
get { return messages; }
set
{
if (value != messages)
{
messages = value;
OnPropertyChanged("Messages");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
[XmlIgnore]
private PassFailStatus result;
[XmlIgnore]
public PassFailStatus Result
{
get { return result; }
set
{
if (value != result)
{
result = value;
OnPropertyChanged("Result");
}
}
}
[XmlElement]
public object MeasuredValue { get; set; }
[XmlIgnore]
public StringBuilder AdditionalInformation { get; set; }
[XmlIgnore]
private bool testHasAdditionalInformation;
[XmlIgnore]
public bool TestHasAdditionalInformation
{
get { return testHasAdditionalInformation; }
set
{
if (value != testHasAdditionalInformation)
{
testHasAdditionalInformation = value;
OnPropertyChanged("TestHasAdditionalInformation");
}
}
}
public TestResult()
{
AdditionalInformation = new StringBuilder();
Result = PassFailStatus.Unknown;
}
/// <summary>
/// Copy constructor.
/// </summary>
/// <param name="copyThis"></param>
public TestResult(TestResult copyThis)
{
AdditionalInformation = new StringBuilder(copyThis.AdditionalInformation.ToString());
result = copyThis.result;
PCode = copyThis.PCode;
MethodName = copyThis.MethodName;
testHasAdditionalInformation = copyThis.testHasAdditionalInformation;
TestName = copyThis.TestName;
UnitOfMeasure = copyThis.UnitOfMeasure;
messages = copyThis.messages;
PropertyChanged = copyThis.PropertyChanged;
}
/// <summary>
/// Handles property change events for all public properties that are bound to the view.
/// </summary>
/// <param name="propertyName"></param>
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = this.PropertyChanged;
if (handler != null)
{
var e = new PropertyChangedEventArgs(propertyName);
handler(this, e);
}
}
/// <summary>
/// Sets the test results to the grid for the user to view.
/// </summary>
/// <param name="testHasAdditionalInformation"></param>
public void SetTestResults(bool testHasAdditionalInformation)
{
TestHasAdditionalInformation = testHasAdditionalInformation;
}
}
}