public Animatroller.Framework.PhysicalDevice.DigitalOutput AddDigitalOutput(DigitalOutput2 logicalDevice) { var moduleControl = new Control.ModuleControl(); moduleControl.Text = logicalDevice.Name; moduleControl.Size = new System.Drawing.Size(80, 80); var centerControl = new Control.CenterControl(); moduleControl.ChildControl = centerControl; var control = new Animatroller.Simulator.Control.Bulb.LedBulb(); control.On = false; control.Size = new System.Drawing.Size(20, 20); centerControl.ChildControl = control; flowLayoutPanelLights.Controls.Add(moduleControl); var device = new Animatroller.Framework.PhysicalDevice.DigitalOutput(x => { if (PendingClose) { return; } Task.Run(() => { this.UIThread(delegate { control.On = x; }); }); }); device.Connect(logicalDevice); return(device); }
public Animatroller.Framework.PhysicalDevice.DigitalOutput AddDigitalOutput(string name) { var moduleControl = new Control.ModuleControl(); moduleControl.Text = name; moduleControl.Size = new System.Drawing.Size(80, 80); var centerControl = new Control.CenterControl(); moduleControl.ChildControl = centerControl; var control = new Animatroller.Simulator.Control.Bulb.LedBulb(); control.On = false; control.Size = new System.Drawing.Size(20, 20); centerControl.ChildControl = control; flowLayoutPanelLights.Controls.Add(moduleControl); var device = new Animatroller.Framework.PhysicalDevice.DigitalOutput(x => { this.UIThread(delegate { control.On = x; }); }); return device; }