Uctl_YJContro.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using IMCS.Config;
  2. using IMCS.DefaultList;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace IMCS.Componen
  13. {
  14. /// <summary>
  15. /// 保障单元
  16. /// </summary>
  17. public partial class Uctl_YJContro : UserControlBase
  18. {
  19. public DeviceStateDefaultList deviceStateDefaultList { get; set; } = new DeviceStateDefaultList();
  20. Uctl_OComponen1 uctl_OComponen1 = new Uctl_OComponen1();
  21. public Uctl_YJContro()
  22. {
  23. InitializeComponent();
  24. this.Load += (s, e) =>
  25. {
  26. lb_Name.TextAlign = ContentAlignment.MiddleLeft;
  27. lb_ConnectionMes.TextAlign = ContentAlignment.MiddleCenter;
  28. lb_OnLine.TextAlign = ContentAlignment.MiddleCenter;
  29. lb_Runing.TextAlign = ContentAlignment.MiddleCenter;
  30. deviceStateDefaultList.PropertyChanged += DeviceStateDefaultList_PropertyChanged;
  31. };
  32. }
  33. private void Pan_left_bottom_DragDrop(object sender, DragEventArgs e)
  34. {
  35. EventMoudeDrag(UserTag);
  36. }
  37. private void Pan_left_bottom_Click(object sender, EventArgs e)
  38. {
  39. EventMoudeDown(UserTag);
  40. }
  41. private void DeviceStateDefaultList_PropertyChanged(object sender, PropertyChangedEventArgs e)
  42. {
  43. DeviceStateDefaultList dl = sender as DeviceStateDefaultList;
  44. switch (e.PropertyName)
  45. {
  46. case "Device_OnLine":
  47. this.lb_OnLine.BeginInvoke(new Action(() =>
  48. {
  49. if (dl.Device_OnLine)
  50. {
  51. this.lb_OnLine.Text = "在线";
  52. this.lb_OnLine.BackColor = System.Drawing.Color.FromArgb(0, 178, 89);
  53. }
  54. else
  55. {
  56. this.lb_OnLine.Text = "离线";
  57. lb_OnLine.BackColor = System.Drawing.Color.FromArgb(201, 201, 201);
  58. }
  59. }));
  60. break;
  61. case "Device_ConnectionMes":
  62. this.lb_ConnectionMes.BeginInvoke(new Action(() =>
  63. {
  64. if (dl.Device_ConnectionMes)
  65. {
  66. this.lb_ConnectionMes.Text = "系统监管"; this.lb_ConnectionMes.BackColor = System.Drawing.Color.FromArgb(0, 178, 89);
  67. }
  68. else
  69. {
  70. this.lb_ConnectionMes.Text = "不受监管"; this.lb_ConnectionMes.BackColor = System.Drawing.Color.FromArgb(201, 201, 201);
  71. }
  72. }));
  73. break;
  74. case "Device_Name":
  75. this.lb_Name.BeginInvoke(new Action(() =>
  76. {
  77. this.lb_Name.Text = dl.Device_Name;
  78. }));
  79. break;
  80. case "Device_Pan":
  81. this.lb_OnLine.BeginInvoke(new Action(() =>
  82. {
  83. if (dl.Device_Pan.Equals(EnumPlateNum.Plate_Third))
  84. {
  85. //this.uctrl_first.Visible = true;
  86. //this.uctrl_third.Visible = true;
  87. //this.uctrl_two.Visible = true;
  88. }
  89. else if (dl.Device_Pan.Equals(EnumPlateNum.Plate_Two))
  90. {
  91. //dComponen.Visible = true;
  92. }
  93. }));
  94. break;
  95. case "Device_Runing":
  96. this.lb_Runing.BeginInvoke(new Action(() =>
  97. {
  98. if (dl.Device_Runing.Equals(EnumDeviceRunState.RunState_Run))
  99. {
  100. lb_Runing.Text = "运行中"; this.lb_Runing.BackColor = System.Drawing.Color.FromArgb(0, 178, 89);
  101. }
  102. else if (dl.Device_Runing.Equals(EnumDeviceRunState.RunState_Err))
  103. {
  104. lb_Runing.Text = "故障中"; this.lb_Runing.BackColor = System.Drawing.Color.Red;
  105. }
  106. else
  107. {
  108. lb_Runing.Text = "空闲"; this.lb_Runing.BackColor = System.Drawing.Color.FromArgb(201, 201, 201);
  109. }
  110. }));
  111. break;
  112. }
  113. }
  114. }
  115. }