Esempio n. 1
0
        static void Main(string[] args)
        {
            Cook cook = new Cook(); // Emisor

            MessageService messageService = new MessageService(cook); // Suscriptor

            bool finalizar = false;

            while (!finalizar)
            {

                int function = messageService.showMenu();

                switch (function)
                {

                    case 1:

                        cook.askForTime();

                        cook.defrost();

                        break;

                    case 2:

                        cook.askForTime();

                        cook.keepWarm();

                        break;

                    case 3:

                        finalizar = true;

                        break;

                    default:

                        continue;

                } // switch

            } // while

            Console.WriteLine();

            Console.WriteLine("Presione una tecla para salir!");

            Console.ReadKey();
        }
Esempio n. 2
0
        public MessageService(Cook currentCook)
        {
            cook = currentCook;

            cook.timeoutEvent += OnTimeout;
        }