Uctl_OComponen2.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. /// <summary>
  14. /// 只有一个托盘的时候, 只显示最底层的, 如果还有一个夹具, 那么显示两层,如果还有零件, 那么就三层,
  15. /// 毛胚件是灰色的, 正在加工的是浅蓝色,加工完成的是
  16. /// </summary>
  17. public partial class Uctl_OComponen2 : UserControl
  18. {
  19. public DeviceStateDefaultList deviceStateDefaultList { get; set; } = new DeviceStateDefaultList();
  20. public Uctl_OComponen2()
  21. {
  22. InitializeComponent();
  23. this.Load += (s, e) =>
  24. {
  25. deviceStateDefaultList.PropertyChanged += DeviceStateDefaultList_PropertyChanged;
  26. };
  27. }
  28. private void DeviceStateDefaultList_PropertyChanged(object sender, PropertyChangedEventArgs e)
  29. {
  30. DeviceStateDefaultList dl = sender as DeviceStateDefaultList;
  31. switch (e.PropertyName)
  32. {
  33. case "Device_OnLine":
  34. {
  35. this.BeginInvoke(new Action(() =>
  36. {
  37. if (dl.Device_OnLine)
  38. {
  39. this.panel1.Visible = true;
  40. this.panel2.Visible = true;
  41. this.panel3.Visible = true;
  42. this.panel1.BackColor = System.Drawing.Color.FromArgb(0, 204, 255);
  43. this.panel2.BackColor = System.Drawing.Color.FromArgb(0, 51, 255);
  44. this.panel3.BackColor = System.Drawing.Color.FromArgb(0, 51, 255);
  45. }
  46. else
  47. {
  48. this.panel1.Visible = false;
  49. this.panel2.Visible = false;
  50. this.panel3.Visible = false;
  51. this.BackColor = System.Drawing.Color.FromArgb(223, 223, 223);
  52. }
  53. }));
  54. }
  55. break;
  56. }
  57. }
  58. }
  59. }