RfItem.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Runtime.Serialization;
  6. using System.Text;
  7. using Aitex.Core.UI.MVVM;
  8. namespace Aitex.Core.UI.ControlDataContext
  9. {
  10. [DataContract]
  11. [Serializable]
  12. public class RfItem : ViewModelBase
  13. {
  14. /// <summary>
  15. /// 设备的唯一名称,UI与RT交互的ID
  16. /// </summary>
  17. [DataMember]
  18. public string DeviceName { get; set; }
  19. /// <summary>
  20. /// 显示在界面上的名称
  21. /// </summary>
  22. [DataMember]
  23. public string DisplayName { get; set; }
  24. /// <summary>
  25. /// IO 表中定义的物理编号,物理追溯使用 比如: M122
  26. /// </summary>
  27. [DataMember]
  28. public string DeviceId { get; set; }
  29. [DataMember]
  30. public string Unit { get; set; }
  31. [DataMember]
  32. public string Description { get; set; }
  33. /// <summary>
  34. /// 量程
  35. /// </summary>
  36. [DataMember]
  37. public double Scale { get; set; }
  38. /// <summary>
  39. /// 设定值
  40. /// </summary>
  41. [DataMember]
  42. public double SetPoint { get; set; }
  43. public double _feedback;
  44. public double FeedBack
  45. {
  46. get
  47. {
  48. return _feedback;
  49. }
  50. set
  51. {
  52. _feedback = value;
  53. InvokePropertyChanged("FeedBack");
  54. }
  55. }
  56. public double PowerDisplay
  57. {
  58. get
  59. {
  60. return _feedback;
  61. }
  62. set
  63. {
  64. _feedback = value;
  65. InvokePropertyChanged("FeedBack");
  66. }
  67. }
  68. /// <summary>
  69. /// 默认值
  70. /// </summary>
  71. [DataMember]
  72. public double DefaultValue { get; set; }
  73. /// <summary>
  74. /// 是否有报警
  75. /// </summary>
  76. [DataMember]
  77. public bool IsWarning { get; set; }
  78. /// <summary>
  79. /// alarm或是erro时显示的信息
  80. /// </summary>
  81. [DataMember]
  82. public string ErroMessage { get; set; }
  83. /// <summary>
  84. /// MFC,PC
  85. /// </summary>
  86. [DataMember]
  87. public string Type { get; set; }
  88. [DataMember]
  89. public string UIDisplay
  90. {
  91. get
  92. {
  93. return string.Format("{0}:{1}", ForwardPower, ReflectPower);
  94. }
  95. }
  96. public string BackgroundColor
  97. {
  98. get
  99. {
  100. if (IsError) return "#FF0000";
  101. if (!IsInterlockOn) return "#FFFF00";
  102. if (IsPowerOn) return "#E69826";
  103. return "#F1A2E4";
  104. }
  105. }
  106. public double ForwardPower { get; set; }
  107. public double ReflectPower { get; set; }
  108. public bool IsInterlockOn { get; set; }
  109. public bool IsPowerOn { get; set; }
  110. public bool IsError { get; set; }
  111. private double _factor = 1.0;
  112. [DataMember]
  113. public double Factor
  114. {
  115. get { return _factor; }
  116. set { _factor = value; }
  117. }
  118. public int State { get; set; }
  119. public RfItem()
  120. {
  121. DisplayName = "Undefined";
  122. }
  123. public void Update(RfItem item)
  124. {
  125. this.DefaultValue = item.DefaultValue;
  126. this.Description = item.Description;
  127. this.DeviceId = item.DeviceId;
  128. this.DeviceName = item.DeviceName;
  129. this.DisplayName = item.DisplayName;
  130. this.ErroMessage = item.ErroMessage;
  131. this.Factor = item.Factor;
  132. this.FeedBack = item.FeedBack;
  133. this.IsWarning = item.IsWarning;
  134. this.PowerDisplay = item.PowerDisplay;
  135. this.Scale = item.Scale;
  136. this.SetPoint = item.SetPoint;
  137. this.Unit = item.Unit;
  138. this.Type = item.Type;
  139. InvokePropertyChanged();
  140. }
  141. }
  142. public class RfOperation
  143. {
  144. public const string Ramp = "Ramp";
  145. }
  146. }