Beispiel #1
0
        static void Main(string[] args)
        {
            // The client code can parameterize an invoker with any commands.
            var invoker = new Invoker();

            invoker.SetOnStart(new SimpleCommand("Say Hi!"));
            var receiver = new Receiver();

            invoker.SetOnFinish(new ComplexCommand(receiver, "Send email", "Save report"));

            invoker.DoSomethingImportant();


            Console.WriteLine('\n');

            // Initialization pattern for Command
            var receiver2       = new Receiver();
            var simpleCommand2  = new SimpleCommand("Say Hi2");
            var complexCommand2 = new ComplexCommand(receiver: receiver2, "Send email2", "Save report2");
            var invoker2        = new Invoker();

            invoker2.SetOnStart(simpleCommand2);
            invoker2.SetOnFinish(complexCommand2);
            invoker2.DoSomethingImportant();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var invoker = new Invoker();

            invoker.SetOnStart(new SimpleCommand("Say Hi!"));
            invoker.SetOnLoad(new SimpleCommand("I'm Loading..."));
            invoker.SetOnFinish(new ComplexCommand(new Receiver(), "Send email", "Save report"));

            invoker.DoSomethingImport();
        }
        static void Main(string[] args)
        {
            // The client code can parameterize an invoker with any commands.
            Invoker invoker = new Invoker();

            invoker.SetOnStart(new SimpleCommand("Say Hi!"));
            Receiver receiver = new Receiver();

            invoker.SetOnFinish(new ComplexCommand(receiver, "Send email", "Save report"));

            invoker.DoSomethingImportant();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            // Клиентский код может параметризовать отправителя любыми
            // командами.
            Invoker invoker = new Invoker();

            invoker.SetOnStart(new SimpleCommand("Say Hi!"));
            Receiver receiver = new Receiver();

            invoker.SetOnFinish(new ComplexCommand(receiver, "Send email", "Save report"));

            invoker.DoSomethingImportant();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            // The client code can parameterize an invoker with any commands.
            Invoker invoker = new Invoker();

            invoker.SetOnStart(new SimpleCmd("Command Start"));
            Receiver receiver = new Receiver();

            invoker.SetOnFinish(new ComplexCmd(receiver, "Do Stuff", "Do Complex Command"));

            invoker.DoSomethingImportant();

            Console.WriteLine("The Ray Code is AWESOME!!!");
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            // Клиентский код может параметризовать отправителя любыми
            // командами.
            Invoker invoker = new Invoker();

            invoker.SetOnStart(new WaiterGettingOrder("Say Hi!"));
            Cooker receiver = new Cooker();

            invoker.SetOnProcess(new WaiterHendToCooker(receiver, "Make fish", "Make meat"));

            invoker.SetOnFinish(new Taxi("Taxi is driving to client"));

            invoker.DoSomethingImportant();

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Invoker invoker = new Invoker();

            TaskManager task = new TaskManager();

            //REALIZA NO INICO O CONCRETE COMANDO
            invoker.SetOnStart(new SimpleCommand("Say Hi!"));

            //INSTANCIA O RECEIVER PARA O INVOKER
            Receiver receiver = new Receiver();

            //REALIZA NO FIM O COMPLEX COMANDO
            invoker.SetOnEnd(new ComplexCommand(receiver, task, "Send email", "Save report"));

            //REALIZA AS FUNÇÕES
            invoker.SetCommand();

            task.Redo();
            Console.ReadLine();
        }