Exemplo n.º 1
0
        internal static void MakeSynchronous()
        {
            Coffee cup = PourCoffee();

            Console.WriteLine("coffee is ready");

            Egg eggs = FryEggs(2);

            Console.WriteLine("eggs are ready");

            Bacon bacon = FryBacon(3);

            Console.WriteLine("bacon is ready");

            Toast toast = ToastBread(2);

            ApplyButter(toast);
            ApplyJam(toast);
            Console.WriteLine("toast is ready");

            Juice oj = PourOJ();

            Console.WriteLine("oj is ready");
            Console.WriteLine("Breakfast is ready!");
        }
Exemplo n.º 2
0
        public async Task <Bacon[]> FryBacon(int amount)
        {
            Bacon bacon = Util.Extensions.ObjectExtensions.NewObject <Bacon>();

            bacon.bacons = new Bacon[amount];
            for (int i = 0; i < bacon.bacons.Length; i++)
            {
                Console.WriteLine("Heat the Pan");
                await Task.Delay(3000);

                Console.WriteLine("Put bacon to");
                await Task.Delay(2000);

                Console.WriteLine("flipp up");
                await Task.Delay(2000);

                bacon.bacons[i] = Util.Extensions.ObjectExtensions.NewObject <Bacon>();
                Console.WriteLine("bacon is ready");
            }
            return(bacon.bacons);
        }