예제 #1
0
파일: EventTest.cs 프로젝트: Fonour/study
 public static void Test()
 {
     AccountEvent he = new AccountEvent("小何");
     SmsNotify sms = new SmsNotify();
     WeChatNotify wechat = new WeChatNotify();
     EmailNotify email = new EmailNotify();
     he.NotifyHandler += sms.NotifySms;
     he.NotifyHandler += wechat.NotifyWeChat; ;
     he.NotifyHandler += email.NotifyEmail;
     he.Notify();
 }
예제 #2
0
        public static void Test()
        {
            AccountDetegate he     = new AccountDetegate("何总");
            SmsNotify       sms    = new SmsNotify();
            WeChatNotify    wechat = new WeChatNotify();
            EmailNotify     email  = new EmailNotify();

            he.updateEventHandler += new UpdateEventHandler(sms.NotifySms);
            he.updateEventHandler += wechat.NotifyWeChat;;
            he.updateEventHandler += email.NotifyEmail;
            he.Notify();
            AccountDetegate mao = new AccountDetegate("毛总");

            mao.updateEventHandler += sms.NotifySms;
            mao.updateEventHandler += wechat.NotifyWeChat;
            mao.Notify();
        }