public Office() { GreetByUs = null; ByeByUs = null; timeEvent = new TimeOfDayEvent(); employeeEvent = new EmployeeEvent(); timeEvent.TimeEvent += Time_State; employeeEvent.Employee += Employee_State; }
//Обработка события смены времени private void Time_State(TimeOfDayEvent sender, TimeStateEventArgs time) { if (sender == timeEvent) { if (time.eventTime == 1) { Console.WriteLine("[Time of day is before 12]"); } if (time.eventTime == 2) { Console.WriteLine("[Time of day is between 12 and 17]"); } if (time.eventTime == 3) { Console.WriteLine("[Time of day is under 17]"); } } }