Esempio n. 1
0
        static void Main()
        {
            // Create receiver, command, and invoker
            Receiver ReceiverObject = new Receiver();

            //Creates a ConcreteCommand object and sets its receiver
            //Instantiates the command object and provides the information required to call the method at a later time.
            Command CommandObject = new ConcreteCommand(ReceiverObject);

            // Invoker - Asks the command to carry out the request.
            // Decides when the method should be called.
            Invoker InvokerObject = new Invoker();
            InvokerObject.SetCommand(CommandObject);
            InvokerObject.ExecuteCommand();

            // Wait for user
            Console.Read();
        }
Esempio n. 2
0
 // Constructor takes the linked Receiver object, the same receiver object (called linked receiver) might be used by other concrete commands which will be passed from client.
 public ConcreteCommand(Receiver receiver)
     : base(receiver)
 {
 }
Esempio n. 3
0
 public Command(Receiver receiver)
 {
     this.receiver = receiver;
 }
Esempio n. 4
0
 public ConcreteCommand(Receiver receiver) : base(receiver)
 {
 }
Esempio n. 5
0
 public Command(Receiver receiver)
 {
     _receiver = receiver;
 }