Exemplo n.º 1
0
        public void GetAGeek(Geek geek)
        {
            Console.WriteLine("Searching for a Geek in your contacts...");
            Thread.Sleep(3000);

            OnContacts(geek);
        }
Exemplo n.º 2
0
 protected virtual void OnContacts(Geek geek)
 {
     ContactEventHandler?.Invoke(this, new GeekEventArgs()
     {
         Geek = geek
     });
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var geek = new Geek()
            {
                Name    = "Dachi",
                Mail    = "*****@*****.**",
                Phone   = "123456789",
                WebSite = "soydachi.com"
            };

            var contacts       = new Contacts();       // publisher
            var mailService    = new MailService();    // subscriber
            var messageService = new MessageService(); // suscriber

            contacts.ContactEventHandler += mailService.OnSendMailToGeek;
            contacts.ContactEventHandler += messageService.OnSendMessageToGeek;

            contacts.GetAGeek(geek);

            Console.ReadLine();
        }