コード例 #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;
 }