コード例 #1
0
        public void sendCommandToDevice()
        {
            DeviceCommandEvent command = new DeviceCommandEvent();

            command.shouldTurnOn = true;
            foreach (IObserveDevice device in observers)
            {
                device.reactOnCommand(command);
            }
        }
コード例 #2
0
ファイル: Device.cs プロジェクト: sughalith/DeviceSheduler
 public void reactOnCommand(DeviceCommandEvent command)
 {
     if (command.shouldTurnOn)
     {
         turnOn();
     }
     if (command.shouldTurnOff)
     {
         turnOff();
     }
 }