示例#1
0
        public void TestMethod1()
        {
            //check console output
            MailManager mailManager = new MailManager();
            FaxReceiver faxReceiver = new FaxReceiver(mailManager);
            PcReceiver  pcReceiver  = new PcReceiver(mailManager);

            mailManager.ReceiveEmail("Boss", "Me");

            mailManager.ReceiveEmail("HR", "CEO");
        }
示例#2
0
 public FaxReceiver(MailManager mm)
 {
     //register interest in event
     mm.NewMail += FaxMsg;
 }
示例#3
0
 public PcReceiver(MailManager mm)
 {
     mm.NewMail += PcMsg;
 }
示例#4
0
 //to unsubscribe from event
 public void Unregister(MailManager mm)
 {
     mm.NewMail -= FaxMsg;
 }