Uctl_OContro2.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. public partial class Uctl_OContro2 : UserControlBase
  15. {
  16. public DeviceStateDefaultList deviceStateDefaultList { get; set; } = new DeviceStateDefaultList();
  17. Uctl_OComponen1 uctl_OComponen1 = new Uctl_OComponen1();
  18. //public override event Delegate_MouseDownTag UserControlMouseDown;
  19. //public override event Delegate_DragDropTag UserControlDragDropTag;
  20. /// <summary>
  21. /// 是否是AGV接驳位的高位
  22. /// </summary>
  23. public bool UserAgvH { get; set; } = false;
  24. public Uctl_OContro2()
  25. {
  26. InitializeComponent();
  27. this.Load += (s, e) =>
  28. {
  29. //this.lb_Name.BackColor = System.Drawing.Color.Green;
  30. lb_Name.TextAlign = ContentAlignment.MiddleLeft;
  31. this.
  32. deviceStateDefaultList.PropertyChanged += DeviceStateDefaultList_PropertyChanged;
  33. this.pan_left_top.MouseDown += Pan_left_top_Click;
  34. this.pan_left_cen.MouseDown += Pan_left_top_Click;
  35. this.pan_left_bottom.MouseDown += Pan_left_top_Click;
  36. this.pan_right_top.MouseDown += Pan_right_top_Click;
  37. this.pan_right_bottom.MouseDown += Pan_right_top_Click;
  38. this.pan_right_cen.MouseDown += Pan_right_top_Click;
  39. this.pan_left_top.DragDrop += Pan_left_top_DragDrop;
  40. this.pan_left_cen.DragDrop += Pan_left_top_DragDrop;
  41. this.pan_left_bottom.DragDrop += Pan_left_top_DragDrop;
  42. this.pan_right_top.DragDrop += Pan_right_top_DragDrop;
  43. this.pan_right_bottom.DragDrop += Pan_right_top_DragDrop;
  44. this.pan_right_cen.DragDrop += Pan_right_top_DragDrop;
  45. this.pan_left.Click += (t, k) =>
  46. {
  47. EventMoudeDown(-1);
  48. };
  49. this.pan_right.Click += (t, k) =>
  50. {
  51. };
  52. };
  53. }
  54. private void Pan_right_top_DragDrop(object sender, DragEventArgs e)
  55. {
  56. if (UserAgvH)
  57. {
  58. UserTag = 121;
  59. }
  60. else
  61. {
  62. UserTag = 119;
  63. }
  64. EventMoudeDown(UserTag);
  65. }
  66. private void Pan_left_top_DragDrop(object sender, DragEventArgs e)
  67. {
  68. if (UserAgvH)
  69. {
  70. UserTag = 122;
  71. }
  72. else
  73. {
  74. UserTag = 120;
  75. }
  76. EventMoudeDrag(UserTag);
  77. }
  78. private void Pan_right_top_Click(object sender, EventArgs e)
  79. {
  80. if (UserAgvH)
  81. {
  82. UserTag = 121;
  83. }
  84. else
  85. {
  86. UserTag = 119;
  87. }
  88. EventMoudeDrag(UserTag);
  89. }
  90. private void Pan_left_top_Click(object sender, EventArgs e)
  91. {
  92. if (UserAgvH)
  93. {
  94. UserTag = 122;
  95. }
  96. else
  97. {
  98. UserTag = 120;
  99. }
  100. EventMoudeDown(UserTag);
  101. }
  102. //public override void EventMoudeDown(int value)
  103. //{
  104. // if (UserControlMouseDown != null)
  105. // {
  106. // UserControlMouseDown(value);
  107. // }
  108. // base.EventMoudeDown(value);
  109. //}
  110. private void DeviceStateDefaultList_PropertyChanged(object sender, PropertyChangedEventArgs e)
  111. {
  112. DeviceStateDefaultList dl = sender as DeviceStateDefaultList;
  113. switch (e.PropertyName)
  114. {
  115. case "Device_OnLine":
  116. break;
  117. case "Device_ConnectionMes":
  118. break;
  119. case "Device_Name":
  120. this.lb_Name.BeginInvoke(new Action(() =>
  121. {
  122. this.lb_Name.Text = dl.Device_Name;
  123. }));
  124. break;
  125. case "Device_Pan":
  126. if (dl.Device_Pan.Equals(EnumPlateNum.Plate_One))
  127. {
  128. this.pan_right.BackColor = System.Drawing.Color.FromArgb(223, 223, 223);
  129. this.pan_right_bottom.Visible = false;
  130. this.pan_right_cen.Visible = false;
  131. this.pan_right_top.Visible = false;
  132. }
  133. else if (dl.Device_Pan.Equals(EnumPlateNum.Plate_Zero))
  134. {
  135. this.pan_left.Visible = false;
  136. this.pan_right.Visible = false;
  137. this.pan_Ful.BackColor = System.Drawing.Color.FromArgb(223, 223, 223);
  138. }
  139. else if (dl.Device_Pan.Equals(EnumPlateNum.Plate_Two))
  140. {
  141. }
  142. break;
  143. case "Device_Runing":
  144. break;
  145. }
  146. }
  147. }
  148. }