static void Main(string[] args) { Person lena = new Person { Name = "Лена" }; Person sasha = new Person { Name = "Саша" }; Person sonya = new Person { Name = "Соня" }; List <Person> list = new List <Person>(); list.Add(lena); list.Add(sasha); list.Add(sonya); Office office = new Office(list); /*lena.onCome += lena.Greet; * sasha.onCome += sasha.Greet; * sonya.onCome += sonya.Greet;*/ lena.Come(DateTime.Now); sasha.Come(DateTime.Now); sonya.Come(DateTime.Now); lena.Leave(); sasha.Leave(); sonya.Leave(); Console.ReadLine(); }
/// <summary> /// В офис пришел один сотрудник. /// </summary> public void ComeOneEmployee(Person person, DateTime time) { person.OnHello += OnCameHandler; person.OnGoodbye += OnLeaveHandler; person.Come(time); persons.Add(person); }