using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Reflection; using System.Runtime.Serialization; using System.Text; using System.Windows; using System.Windows.Input; using Aitex.Core.UI.MVVM; namespace Aitex.Core.Common.DeviceData { [DataContract] [Serializable] public class AITVaporLineData : INotifyPropertyChanged, IDeviceData { public event PropertyChangedEventHandler PropertyChanged; public void InvokePropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } public void InvokePropertyChanged() { PropertyInfo[] ps = this.GetType().GetProperties(); foreach (PropertyInfo p in ps) { InvokePropertyChanged(p.Name); if (p.PropertyType == typeof (ICommand)) { DelegateCommand cmd = p.GetValue(this, null) as DelegateCommand; if (cmd != null) cmd.RaiseCanExecuteChanged(); } } FieldInfo[] fi = this.GetType().GetFields(); foreach (FieldInfo p in fi) { InvokePropertyChanged(p.Name); if (p.FieldType == typeof (ICommand)) { DelegateCommand cmd = p.GetValue(this) as DelegateCommand; if (cmd != null) cmd.RaiseCanExecuteChanged(); } } } /// /// 设备的唯一名称,UI与RT交互的ID /// [DataMember] public string DeviceName { get; set; } /// /// 显示在界面上的名称 /// [DataMember] public string DisplayName { get; set; } /// /// IO 表中定义的物理编号,物理追溯使用 比如: M122 /// [DataMember] public string DeviceSchematicId { get; set; } [DataMember] public string Unit { get; set; } [DataMember] public string Description { get; set; } /// /// 量程 /// [DataMember] public double Scale { get; set; } /// /// 设定值 /// [DataMember] public double SetPoint { get; set; } [DataMember] public double FeedBack { get; set; } /// /// 默认值 /// [DataMember] public double DefaultValue { get; set; } /// /// 是否有报警 /// [DataMember] public bool IsWarning { get; set; } /// /// alarm或是erro时显示的信息 /// [DataMember] public string ErroMessage { get; set; } /// /// MFC,PC /// [DataMember] public string Type { get; set; } [DataMember] public double Factor { get; set; } private string _title; [DataMember] public string DisplayTitle { get { return string.Format("{0}({1})", DeviceSchematicId, DisplayName); } set { _title = value; } } [DataMember] public bool HasMFC { get; set; } public Visibility MFCVisibility { get { return HasMFC ? Visibility.Visible : Visibility.Hidden; } } [DataMember] public AITValveData SupplyValveData { get; set; } [DataMember] public AITValveData RunValveData { get; set; } [DataMember] public AITValveData BypassValveData { get; set; } [DataMember] public AITValveData FeedValveData { get; set; } [DataMember] public AITMfcData SupplyMFCData { get; set; } [DataMember] public AITPressureMeterData PressureMeterData { get; set; } [DataMember] public AITSensorData HighLevelSensordata { get; set; } [DataMember] public AITSensorData MiddleLevelSensordata { get; set; } [DataMember] public AITSensorData LowLevelSensordata { get; set; } [DataMember] public AITHeaterData HeaterData { get; set; } public AITVaporLineData() { DisplayName = "Undefined"; Factor = 1.0; Unit = ""; Type = "Vapor"; } public void Update(IDeviceData data) { throw new NotImplementedException(); } } public class AITVaporLineOperation { public const string Pump = "Pump"; } }