public CeilingFanLowCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }
 public CeilingFanHighCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }
 public CeilingFanMediumCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }
Beispiel #4
0
 public CeilingFanHighCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }
Beispiel #5
0
        static void Main(string[] args)
        {
            RemoteControlWithUndo remoteControl = new RemoteControlWithUndo();

            Light livingRoomLight = new Light("Living Room");

            LightOnCommand livingRoomLightOn = new LightOnCommand(livingRoomLight);
            LightOffCommand livingRoomLightOff = new LightOffCommand(livingRoomLight);

            remoteControl.SetCommand(0, livingRoomLightOn, livingRoomLightOff);

            remoteControl.OnButtonWasPushed(0);
            remoteControl.OffButtonWasPushed(0);

            Console.WriteLine(remoteControl);

            remoteControl.UndoButtonWasPushed();
            remoteControl.OffButtonWasPushed(0);
            remoteControl.OnButtonWasPushed(0);

            Console.WriteLine(remoteControl);

            remoteControl.UndoButtonWasPushed();

            CeilingFan ceilingFan = new CeilingFan("Living Room");

            CeilingFanMediumCommand ceilingFanMedium = new CeilingFanMediumCommand(ceilingFan);
            CeilingFanHighCommand ceilingFanHigh = new CeilingFanHighCommand(ceilingFan);
            CeilingFanOffCommand ceilingFanOff = new CeilingFanOffCommand(ceilingFan);

            remoteControl.SetCommand(0, ceilingFanMedium, ceilingFanOff);
            remoteControl.SetCommand(1, ceilingFanHigh, ceilingFanOff);

            remoteControl.OnButtonWasPushed(0);
            remoteControl.OffButtonWasPushed(0);

            Console.WriteLine(remoteControl);

            remoteControl.UndoButtonWasPushed();
            remoteControl.OnButtonWasPushed(1);

            Console.WriteLine(remoteControl);

            remoteControl.UndoButtonWasPushed();

            // Wait for user
            Console.ReadKey();
        }
Beispiel #6
0
 public CeilingFanOffCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }
Beispiel #7
0
 public CeilingFanMediumCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }