public void Coming(DateTime _ComingTime)
 {
     try
     {
         Console.WriteLine("[{0} is coming.]", Name);
         if (SayHelloEvent != null)
         {
             PersonEventArgs _person = new PersonEventArgs(this.Name, _ComingTime);
             SayHelloEvent(this, _person);
         }
         SayHelloEvent   += Ave;
         SayGoodbyeEvent += SayGoodbye;
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Console.ReadKey();
     }
 }
 public void Ave(object sender, PersonEventArgs _person)
 {
     if (!(_person.Equals(null) && sender.Equals(null)))
     {
         if (_person.ComingTime.Hour < 12)
         {
             Console.WriteLine("Good morning,{0} - say {1}", _person.Name, Name);
             return;
         }
         if (_person.ComingTime.Hour < 17)
         {
             Console.WriteLine("Good day,{0} - say {1}", _person.Name, Name);
             return;
         }
         else
         {
             Console.WriteLine("Good evening,{0} - say {1}", _person.Name, Name);
             return;
         }
     }
     throw new ArgumentNullException("PersonEventArgs coming datetime is null");
 }
 public void GoOut()
 {
     try
     {
         if (!SayGoodbyeEvent.Equals(null))
         {
             Console.WriteLine("[{0} go to home.]", Name);
             PersonEventArgs _person = new PersonEventArgs();
             _person.Name       = this.Name;
             _person.ComingTime = DateTime.Now;
             SayGoodbyeEvent   -= SayGoodbye;
             SayHelloEvent     -= Ave;
             if (SayGoodbyeEvent != null)
             {
                 SayGoodbyeEvent(this, _person);
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Console.ReadKey();
     }
 }
 public void SayGoodbye(object sender, PersonEventArgs _person)
 {
     Console.WriteLine("Goodbye,{0}. - say {1}.", _person.Name, Name);
 }