using IMCS.DefaultList; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace IMCS.Componen { /// /// 只有一个托盘的时候, 只显示最底层的, 如果还有一个夹具, 那么显示两层,如果还有零件, 那么就三层, /// 毛胚件是灰色的, 正在加工的是浅蓝色,加工完成的是 /// public partial class Uctl_OComponen2 : UserControl { public DeviceStateDefaultList deviceStateDefaultList { get; set; } = new DeviceStateDefaultList(); public Uctl_OComponen2() { InitializeComponent(); this.Load += (s, e) => { deviceStateDefaultList.PropertyChanged += DeviceStateDefaultList_PropertyChanged; }; } private void DeviceStateDefaultList_PropertyChanged(object sender, PropertyChangedEventArgs e) { DeviceStateDefaultList dl = sender as DeviceStateDefaultList; switch (e.PropertyName) { case "Device_OnLine": { this.BeginInvoke(new Action(() => { if (dl.Device_OnLine) { this.panel1.Visible = true; this.panel2.Visible = true; this.panel3.Visible = true; this.panel1.BackColor = System.Drawing.Color.FromArgb(0, 204, 255); this.panel2.BackColor = System.Drawing.Color.FromArgb(0, 51, 255); this.panel3.BackColor = System.Drawing.Color.FromArgb(0, 51, 255); } else { this.panel1.Visible = false; this.panel2.Visible = false; this.panel3.Visible = false; this.BackColor = System.Drawing.Color.FromArgb(223, 223, 223); } })); } break; } } } }