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_OComponen1 : UserControl { public DeviceStateDefaultList deviceStateDefaultList { get; set; } = new DeviceStateDefaultList(); public Uctl_OComponen1() { 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; } } } }