GasFlowButtonDataItem.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.ComponentModel;
  6. namespace Aitex.Core.UI.ControlDataContext
  7. {
  8. public class GasFlowButtonDataItem : INotifyPropertyChanged
  9. {
  10. Dictionary<string, string> _colorDic = new Dictionary<string, string>()
  11. {
  12. {"N2", "SkyBlue"},
  13. {"H2", "Pink"},
  14. {"N2|H2", "Red"},
  15. {"NH3", "Cyan"},
  16. {"MO", "Gold"},
  17. {"Default", "Gainsboro"},
  18. };
  19. public event PropertyChangedEventHandler PropertyChanged;
  20. public void InvokePropertyChanged(string propertyName)
  21. {
  22. if (PropertyChanged != null)
  23. {
  24. PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  25. }
  26. }
  27. public string DeviceName { get; set; }
  28. string _displayName = "";
  29. public string DisplayName
  30. {
  31. get
  32. {
  33. return _displayName;
  34. }
  35. set
  36. {
  37. _displayName = value;
  38. InvokePropertyChanged("DisplayName");
  39. }
  40. }
  41. string _gasType = "Default";
  42. public string GasType
  43. {
  44. get
  45. {
  46. return _gasType;
  47. }
  48. set
  49. {
  50. _gasType = value;
  51. GasBackgroundColor = MapColor(value);
  52. InvokePropertyChanged("GasType");
  53. InvokePropertyChanged("GasBackgroundColor");
  54. }
  55. }
  56. public string GasBackgroundColor{get; set; }
  57. string _carrierGasName = "";
  58. public string CarrierGasName
  59. {
  60. get
  61. {
  62. return _carrierGasName;
  63. }
  64. set
  65. {
  66. _carrierGasName = value;
  67. CarrierGasBackgroundColor = MapColor(value);
  68. InvokePropertyChanged("CarrierGasName");
  69. InvokePropertyChanged("CarrierGasBackgroundColor");
  70. }
  71. }
  72. public string CarrierGasBackgroundColor{get; set; }
  73. string _pipeGasName = "Default";
  74. public string PipeGasName
  75. {
  76. get
  77. {
  78. return _pipeGasName;
  79. }
  80. set
  81. {
  82. _pipeGasName = value;
  83. PipeGasColor = MapColor(value);
  84. InvokePropertyChanged("PipeGasName");
  85. InvokePropertyChanged("PipeGasColor");
  86. }
  87. }
  88. public string PipeGasColor { get; set; }
  89. bool _isFlow2NH3 = false;
  90. public bool IsFlow2NH3
  91. {
  92. get
  93. {
  94. return _isFlow2NH3;
  95. }
  96. set
  97. {
  98. _isFlow2NH3 = value;
  99. InvokePropertyChanged("IsFlow2NH3");
  100. }
  101. }
  102. bool _isFlow2NH3E = false;
  103. public bool IsFlow2NH3E
  104. {
  105. get
  106. {
  107. return _isFlow2NH3E;
  108. }
  109. set
  110. {
  111. _isFlow2NH3E = value;
  112. InvokePropertyChanged("IsFlow2NH3E");
  113. }
  114. }
  115. bool _isFlow2NH3C = false;
  116. public bool IsFlow2NH3C
  117. {
  118. get
  119. {
  120. return _isFlow2NH3C;
  121. }
  122. set
  123. {
  124. _isFlow2NH3C = value;
  125. InvokePropertyChanged("IsFlow2NH3C");
  126. }
  127. }
  128. bool _isFlow2Run = false;
  129. public bool IsFlow2Run
  130. {
  131. get
  132. {
  133. return _isFlow2Run;
  134. }
  135. set
  136. {
  137. _isFlow2Run = value;
  138. InvokePropertyChanged("IsFlow2Run");
  139. }
  140. }
  141. bool _isFlow2Vent = false;
  142. public bool IsFlow2Vent
  143. {
  144. get
  145. {
  146. return _isFlow2Vent;
  147. }
  148. set
  149. {
  150. _isFlow2Vent = value;
  151. InvokePropertyChanged("IsFlow2Vent");
  152. }
  153. }
  154. string _totalFlow="-";
  155. public string TotalFlow
  156. {
  157. get
  158. {
  159. return _totalFlow;
  160. }
  161. set
  162. {
  163. _totalFlow = value;
  164. InvokePropertyChanged("TotalFlow");
  165. }
  166. }
  167. public GasFlowButtonDataItem()
  168. {
  169. GasType = "default";
  170. CarrierGasName = "";
  171. PipeGasName = "default";
  172. }
  173. string MapColor(string gasName)
  174. {
  175. return _colorDic.ContainsKey(gasName) ? _colorDic[gasName] : _colorDic["Default"];
  176. }
  177. }
  178. }