Пример #1
0
        static void Main(string[] args)
        {
            engine.AddCommand(new Program(1, '1'));
            engine.AddCommand(new Program(3, '3'));
            engine.AddCommand(new Program(5, '5'));
            engine.AddCommand(new Program(7, '7'));
            ICommand stopCommand = new StopCommand();

            engine.AddCommand(new SleepCommand(10000, engine, stopCommand));
            engine.Run();
        }
Пример #2
0
        static void Main(string[] args)
        {
            ActiveObjectEngine.AddCommand(new DelayedTyper(100, '1'));
            ActiveObjectEngine.AddCommand(new DelayedTyper(300, '3'));
            ActiveObjectEngine.AddCommand(new DelayedTyper(500, '5'));
            ActiveObjectEngine.AddCommand(new DelayedTyper(700, '7'));

            Command command = new StopCommand();

            ActiveObjectEngine.AddCommand(new SleepCommand(20000, ActiveObjectEngine, command));
            ActiveObjectEngine.Run();
        }
Пример #3
0
        static void Main(string[] args)
        {
            // Invoker
            var remote = new Remote();

            // Commands
            var play = new PlayCommand();
            var stop = new StopCommand();
            var skip = new SkipTrackCommand();

            // Client invokes commands
            remote.Invoke(play);
            remote.Invoke(skip);
            remote.Invoke(skip);
            remote.Invoke(skip);
            remote.Invoke(stop);
        }