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 List { get; set; } public TestResultList() { List = new List(); } } 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; } /// /// Copy constructor. /// /// 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; } /// /// Handles property change events for all public properties that are bound to the view. /// /// protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { var e = new PropertyChangedEventArgs(propertyName); handler(this, e); } } /// /// Sets the test results to the grid for the user to view. /// /// public void SetTestResults(bool testHasAdditionalInformation) { TestHasAdditionalInformation = testHasAdditionalInformation; } } }