Ejemplo n.º 1
0
        public bool GateOpen(Horses horses)
        {
            Console.WriteLine("Stable gate is Opening");
            Thread.Sleep(2000);
            Console.WriteLine("Stable gate is Opened");
            OnGateOpened(horses);

            return(IsOpen = true);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Stablegate stablegate = new Stablegate();
            Horses     horses     = new Horses();

            try
            {
                stablegate.OnGateOpening += horses.OnGateOpening;
                stablegate.GateOpen(horses);
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
            finally { stablegate.GateClose(); }
            Console.Read();
        }
Ejemplo n.º 3
0
 protected virtual void OnGateOpened(Horses horses)
 {
     OnGateOpening?.Invoke(this, new StablegateEventArgs {
         HorseCount = horses.HorseList().Count
     });
 }