Beispiel #1
0
        // Отправитель не зависит от классов конкретных команд и получателей.
        // Отправитель передаёт запрос получателю косвенно, выполняя команду.
        public void DoSomethingImportant()
        {
            Console.WriteLine("Client: Hello");
            if (this._onStart is IWaiter)
            {
                this._onStart.ToSay();
            }

            Console.WriteLine("Cleint: I am waiting");
            if (_onProcess is IWaiter)
            {
                _onProcess.ToSay();
            }

            Console.WriteLine("Client: I need a taxi");
            if (_onFinish is IWaiter)
            {
                _onFinish.ToSay();
            }
        }