MatrixDevice.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace IntelligentControlForsx.MyControls
  11. {
  12. public partial class MatrixDevice : UserControl
  13. {
  14. public MatrixDevice()
  15. {
  16. InitializeComponent();
  17. }
  18. string deviceId;
  19. string deviceModel;
  20. string stationId;
  21. double windSpeed;
  22. double power;
  23. double status;
  24. [Browsable(true), Category("Data")]
  25. public string DeviceId
  26. {
  27. get
  28. {
  29. return deviceId;
  30. }
  31. set
  32. {
  33. deviceId = value;
  34. lblDeviceId.Text = value;
  35. }
  36. }
  37. [Browsable(true), Category("Data")]
  38. public double WindSpeed
  39. {
  40. get
  41. {
  42. return windSpeed;
  43. }
  44. set
  45. {
  46. windSpeed = value;
  47. lblWindSpeed.Text = Convert.ToDouble(value).ToString("0.00") + "m/s";
  48. }
  49. }
  50. [Browsable(true), Category("Data")]
  51. public double Power
  52. {
  53. get
  54. {
  55. return power;
  56. }
  57. set
  58. {
  59. power = value;
  60. lblPower.Text = Convert.ToDouble(value).ToString("0.00") + "KW";
  61. }
  62. }
  63. [Browsable(true), Category("Data")]
  64. public double Status
  65. {
  66. get
  67. {
  68. return status;
  69. }
  70. set
  71. {
  72. status = value;
  73. this.BackColor = getBackColor(value);
  74. }
  75. }
  76. public string DeviceModel
  77. {
  78. get
  79. {
  80. return deviceModel;
  81. }
  82. set
  83. {
  84. deviceModel = value;
  85. }
  86. }
  87. public string StationId
  88. {
  89. get
  90. {
  91. return stationId;
  92. }
  93. set
  94. {
  95. stationId = value;
  96. }
  97. }
  98. private Color getBackColor(double status)
  99. {
  100. int st = Convert.ToInt32(status);
  101. switch(st)
  102. {
  103. //明细状态
  104. //case 0: //启动状态
  105. //case 7: //低温启动状态
  106. // return Color.FromArgb(0, 51, 102);
  107. //case 1: //待机状态
  108. // return Color.FromArgb(51, 153, 51);
  109. //case 2: //上电状态
  110. // return Color.FromArgb(153, 0, 102);
  111. //case 3: //并网(发电)状态
  112. // return Color.FromArgb(0, 153, 204);
  113. //case 4: //正常停机状态
  114. // return Color.FromArgb(153, 153, 51);
  115. //case 5: //维护状态
  116. // return Color.FromArgb(255, 102, 0);
  117. //case 6: //故障停机状态
  118. // return Color.FromArgb(204, 51, 51);
  119. //case 8: //离线状态
  120. // return Color.FromArgb(153, 153, 153);
  121. //default:
  122. // return Color.Black;
  123. //风机六种状态: 限电5》运行1》待机0》维护4》故障2》离线3
  124. case 4:
  125. return Color.FromArgb(15, 135, 170);
  126. case 2:
  127. return Color.FromArgb(15, 141, 106);
  128. case 5:
  129. return Color.FromArgb(170, 15, 59);
  130. case 6:
  131. return Color.FromArgb(204, 83, 35);
  132. case 7:
  133. return Color.FromArgb(153, 153, 153);
  134. case 3:
  135. return Color.FromArgb(14, 72, 91);
  136. case 0:
  137. return Color.FromArgb(176, 151, 63);
  138. default:
  139. return Color.FromArgb(177, 14, 126);
  140. }
  141. }
  142. }
  143. }