Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Doer          doer          = new Doer();
            UserInterface userInterface = new UserInterface();
            Logger        logger        = new Logger();

            doer.AfterDoSomethingWith += userInterface.AfterDoSomethingWith;
            doer.AfterDoSomethingWith += logger.AfterDoSomethingWith;
            //doer.AfterDoSomethingWith =
            //    new MulticastNotifier<string>(
            //        new IObserver<string>[]
            //        {
            //            userInterface.AfterDoSomethingWith,
            //            logger.AfterDoSomethingWith
            //        });
            doer.AfterDoMore += logger.AfterDoMore;
            //doer.AfterDoMore =
            //    new MulticastNotifier<Tuple<string, string>>(
            //        new IObserver<Tuple<string, string>>[]
            //        {
            //            logger.AfterDoMore
            //        });

            doer.DoSomethingWith("my data");
            doer.DoMore("tail");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var doer   = new Doer();
            var logger = new Logger();

            doer.AfterDoSomethingWith += new UserInterface().UpdateWithTheOriginalMessage;
            doer.AfterDoSomethingWith += logger.UpdateWithTheOriginalMessage;
            doer.AfterDoMore          += logger.UpdateMessage;
            doer.DoSomethingWith("my data");
            doer.DoMore("new message for the logger");
            Console.ReadLine();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Doer doer = new Doer();

            UserInterface userInterface = new UserInterface();
            Logger        logger        = new Logger();

            doer.AfterDoSomethingWith += userInterface.AfterDoSomethingWith;
            doer.AfterDoSomethingWith += logger.AfterDoSomethingWith;

            doer.AfterDoMore += logger.AfterDoMore;

            doer.DoSomethingWith("my data");
            doer.DoMore("tail");

            Console.ReadLine();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            var doer = new Doer();

            UserInterface userInterface = new UserInterface();
            Logger logger = new Logger();

            doer.AfterDoSomethingWith += userInterface.AfterDoSomethingWith;
            doer.AfterDoSomethingWith += logger.AfterDoSomethingWith;

            doer.AfterDoMore += logger.AfterDoMore;

            doer.DoSomethingWith("input data");
            doer.DoMore("additional data processing");

            Console.ReadLine();
        }