コード例 #1
0
ファイル: Client.cs プロジェクト: hkuntal/TeamWorkManagement
        public static void ExecuteCommandPatternInBulk()
        {
            //This is the Invoker that is used to set the command object and will call execute method on the command object.
            RemoteControl objRemoteControl = new RemoteControl();

            //Prepare the object on which the command is to be executed
            Light objLight = new Light();

            //Prepare the command object that is going to work on this command
            LightsOnCommand objLightOnCommand = new LightsOnCommand(objLight);

            //Switch of the button Off
            LightsOffCommand objLightsOffCommand = new LightsOffCommand(objLight);

            //Create the stereo object
            Stereo objStereo = new Stereo();
            StereoOnWithCDCOmmand objStereoOnWithCDCOmmand = new StereoOnWithCDCOmmand(objStereo);

            //Set the commands in the slot
            objRemoteControl.SetCommand(1,objLightOnCommand, objLightsOffCommand);
        }
コード例 #2
0
 public StereoOnWithCDCOmmand(Stereo st)
 {
     _stereo = st;
 }