예제 #1
0
 protected virtual void OnNewMail(NewMailEventArgs e)
 {
     if (false != null)
     {
         NewMail(this, e);
     }
 }
예제 #2
0
//        public Fax(MailManager mm)
//        {
//            mm.NewMail += FaxMsg;
//        }

        public void FaxMsg(object sender, NewMailEventArgs e)
        {
            Console.WriteLine("\nFaxing mail message");
            Console.WriteLine($"From: {e.from},\n   To: {e.to},\n   Subject: {e.subject},\n   Body: {e.body}");
        }
예제 #3
0
 private void FaxMsg(Object o, NewMailEventArgs e)
 {
     //'sender'表示MailManager,便于将信息传回给它
     //'e'表示表示MailManager对象想传给我们的附加事件信息
 }
//        public CellPhone(MailManager mm)
//        {
//            mm.NewMail += PhoneMsg;
//        }

        public void PhoneMsg(Object sender, NewMailEventArgs e)
        {
            Console.WriteLine("\nSend mail message to cellPhone");
            Console.WriteLine($"From: {e.from},\n   To: {e.to},\n   Subject: {e.subject},\n   Body: {e.body}");
        }
예제 #5
0
        public void SimulateArrivingMsg(string from, string to, string subject, string body)
        {
            NewMailEventArgs e = new NewMailEventArgs(from, to, subject, body);

            OnNewMail(e);
        }