예제 #1
0
        static void Main(string[] args)
        {
            var p1 = new Person("Harry");
            var p2 = new Person("Ronanld");
            var p3 = new Person("Germiona");

            p3.Came += p1.Greet;
            p3.Came += p2.Greet;
            p3.OnCame();
        }
예제 #2
0
 public void Add(Person person)
 {
     Console.WriteLine($"[{person.Name} came to work]");
     foreach (var item in Persons)
     {
         person.Came += item.SayHi;
     }
     person.OnCame();
     Persons.Add(person);
     Console.WriteLine();
 }
예제 #3
0
        public void CameEmployee(string name, DateTime datacame)
        {
            Person Employee = new Person(name);

            Employee.TimeCame = datacame;
            foreach (Person item in listEmployee)
            {
                Employee.Came += item.Greet;
            }
            Employee.OnCame();
            listEmployee.Add(Employee);
        }
예제 #4
0
 public void Add(Person person)
 {
     if (person != null)
     {
         Console.WriteLine($"{person.Name} came");
         foreach (var worker in office)
         {
             person.Came += worker.Greet;
         }
         person.OnCame();
         office.Add(person);
         Console.WriteLine();
     }
 }
예제 #5
0
        public void AddWorker(Person person, int hour)
        {
            workers.Add(person);
            person.Came += new EventHandler(Person_Came);
            person.OnCame();
            if (greetByUs != null)
            {
                greetByUs(person, hour);
            }
            MessageHello greetByPerson = new MessageHello(person.Greet);

            greetByUs += greetByPerson;
            MessageBye byeByPerson = new MessageBye(person.GoodBye);

            byeByUs += byeByPerson;
        }