Esempio n. 1
0
 /// <summary>
 /// Method CallEvent
 /// Calls delegate passed.
 /// </summary>
 private void CallEvent(CatalogEventArgs e, CatalogStateHandler handler)
 {
     if ((handler != null) && (e != null))
     {
         handler(this, e);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Method CountTypeHandler
        /// A method that handles a car counting type event.
        /// </summary>
        public void CountTypeHandler(object sender, CatalogEventArgs e)
        {
            ConsoleColor color = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.WriteLine($"Number of brands : {(int)e.ResultOfOperation}\n");
            Console.ForegroundColor = color;
        }
Esempio n. 3
0
        /// <summary>
        /// Method AverageCarPriceHandler
        /// The method that handles the event of calculating the average price of cars.
        /// </summary>
        public void AveragePriceHandler(object sender, CatalogEventArgs e)
        {
            ConsoleColor color = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.WriteLine($"Average cost of the machine : {e.ResultOfOperation}\n");
            Console.ForegroundColor = color;
        }
Esempio n. 4
0
        /// <summary>
        /// Method CountCarHandler
        /// A method that handles a car counting event.
        /// </summary>
        public void CountMachineHandler(object sender, CatalogEventArgs e)
        {
            ConsoleColor color = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.WriteLine($"{sender.GetType()}\n");
            Console.WriteLine($"Total number of machine : {(int)e.ResultOfOperation}\n");
            Console.ForegroundColor = color;
        }