Exemplo n.º 1
0
 //声明一个可重写的OnPublish的保护函数
 protected virtual void OnPublish(PubEventArgs e)
 {
     if (Publish != null)
     {
         //Sender = this,也就是Publisher
         this.Publish(this, e);
     }
 }
Exemplo n.º 2
0
 //对事件感兴趣的事情
 public static void Receive(object sender, PubEventArgs e)
 {
     Console.WriteLine("幼稚,这么大了,还看《火影忍者》,SB小明!");
     Console.WriteLine("这个我定的《" + e.magazineName + "》,哇哈哈!");
 }
Exemplo n.º 3
0
 //对事件感兴趣的事情
 public static void Receive(object sender, PubEventArgs e)
 {
     Console.WriteLine("嘎嘎,我已经收到最新一期的《" + e.magazineName + "》啦!!");
 }