コード例 #1
0
 public CeilingFanLowCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }
コード例 #2
0
 public CeilingFanHighCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }
コード例 #3
0
 public CeilingFanMediumCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }
コード例 #4
0
ファイル: RemoteLoader.cs プロジェクト: ronymaychan/demos
 public CeilingFanHighCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }
コード例 #5
0
ファイル: RemoteLoader.cs プロジェクト: ronymaychan/demos
        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();
        }
コード例 #6
0
ファイル: RemoteLoader.cs プロジェクト: ronymaychan/demos
 public CeilingFanOffCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }
コード例 #7
0
ファイル: RemoteLoader.cs プロジェクト: ronymaychan/demos
 public CeilingFanMediumCommand(CeilingFan ceilingFan)
 {
     this._ceilingFan = ceilingFan;
 }