Uctl_OContro2.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using IMCS.DefaultList;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace IMCS.Componen
  12. {
  13. public partial class Uctl_OContro2 : UserControl
  14. {
  15. public DeviceStateDefaultList deviceStateDefaultList { get; set; } = new DeviceStateDefaultList();
  16. Uctl_OComponen1 uctl_OComponen1 = new Uctl_OComponen1();
  17. public Uctl_OContro2()
  18. {
  19. InitializeComponent();
  20. this.Load += (s, e) =>
  21. {
  22. //this.lb_Name.BackColor = System.Drawing.Color.Green;
  23. lb_Name.TextAlign = ContentAlignment.MiddleLeft;
  24. deviceStateDefaultList.PropertyChanged += DeviceStateDefaultList_PropertyChanged;
  25. //dComponen.Dock = DockStyle.Bottom;
  26. //dComponen.Show();
  27. //dComponen.Visible = false;
  28. //this.Controls.Add(dComponen);
  29. //uctrl_first.Location = new Point(101, 120);
  30. //this.Controls.Add(uctrl_first);
  31. //uctrl_two.Location = new Point(3, 264);
  32. //this.Controls.Add(uctrl_two);
  33. //uctrl_third.Location = new Point(212, 264);
  34. //this.Controls.Add(uctrl_third);
  35. this.MouseDown += (t, k) => {
  36. if (k.Button.Equals(MouseButtons.Right))
  37. {
  38. Point pt=new Point();
  39. pt.Offset(k.Location.X, k.Location.Y);
  40. this.popupMenu1.ShowPopup(Control.MousePosition);
  41. }
  42. };
  43. };
  44. }
  45. private void DeviceStateDefaultList_PropertyChanged(object sender, PropertyChangedEventArgs e)
  46. {
  47. DeviceStateDefaultList dl = sender as DeviceStateDefaultList;
  48. switch (e.PropertyName)
  49. {
  50. case "Device_OnLine":
  51. break;
  52. case "Device_ConnectionMes":
  53. break;
  54. case "Device_Name":
  55. this.lb_Name.BeginInvoke(new Action(() =>
  56. {
  57. this.lb_Name.Text = dl.Device_Name;
  58. }));
  59. break;
  60. case "Device_Pan":
  61. if (dl.Device_Pan.Equals(EnumPlateNum.Plate_One))
  62. {
  63. this.pan_right.BackColor = System.Drawing.Color.FromArgb(223, 223, 223);
  64. this.pan_right_bottom.Visible = false;
  65. this.pan_right_cen.Visible = false;
  66. this.pan_right_top.Visible = false;
  67. }
  68. else if (dl.Device_Pan.Equals(EnumPlateNum.Plate_Zero))
  69. {
  70. this.pan_left.Visible = false;
  71. this.pan_right.Visible = false;
  72. this.pan_Ful.BackColor = System.Drawing.Color.FromArgb(223, 223, 223);
  73. }
  74. else if (dl.Device_Pan.Equals(EnumPlateNum.Plate_Two))
  75. {
  76. }
  77. break;
  78. case "Device_Runing":
  79. break;
  80. }
  81. }
  82. }
  83. }