Пример #1
0
        public void SimulateMailArrived(string from, string to, string obj, string body)
        {
            MailEvevenArgs args = new MailEvevenArgs()
            {
                Body = body,
                From = from,
                To   = to,
                obj  = obj
            };

            ////primometodo
            //MailArrived?.Invoke(this, args);

            ////metodo
            //if (MailArrived != null)
            //{
            //    MailArrived(this, args);
            //}


            //metodo esplicito
            if (MailArrived != null)
            {
                foreach (var item in MailArrived.GetInvocationList().ToList())
                {
                    MailManagerEventHandler mm_eh = (MailManagerEventHandler)item;
                    mm_eh(this, args);
                }
            }
        }
Пример #2
0
 public void mm_MailArrived(Object sender, MailEvevenArgs args)
 {
     Console.WriteLine("I'm a Fax \r\n Mail From {0}, Mail To {1} \r\n obj:{2} \t\t Body: {3}",
                       args.From, args.To, args.obj, args.Body);
 }
Пример #3
0
 private void _mm_MailArrived(object sender, MailEvevenArgs args)
 {
     Console.WriteLine("I'm a Printer \r\n Mail From {0}, Mail To {1} \r\n obj:{2} \t\t Body: {3}",
                       args.From, args.To, args.obj, args.Body);
     Console.ReadLine();
 }