public async Task <bool> PowerOn() { var sendCommand = new PowerOnCommand(); var tlSerialPortAsync = new TLAutoDeviceSerialPortAsync <bool>(TLAutoDeviceSerialPort, sendCommand, null, _logModuleName, _timeOutMs); return(await tlSerialPortAsync.InvokeAsync()); }
static void Main(string[] args) { ISwitchable switcher = new LightSwitcher(); ICommand on = new PowerOnCommand(switcher); ICommand off = new PowerOffCommand(switcher); var invoker = new SwitchInvoker(on, off); Console.WriteLine("Lights ON =>"); invoker.LightOn(); Console.WriteLine(); Console.WriteLine("Lights OFF =>"); invoker.LightOff(); Console.WriteLine(); Console.ReadKey(); }