Exemplo n.º 1
0
 //被注册的方法,订阅者收到事件后需要执行的方法
 //按照.NET Framework准则,注册方法需要接收两个参数,第一个参数是事件源,第二个是自定义事件
 public void MakeAlart(Heater obj, BoiledEventArgs e)
 {
     Console.WriteLine("Alarm recived event,temperature: {0} ,made by {1}", e.Tempareture, obj.Producer);
 }
Exemplo n.º 2
0
 //被注册的方法,订阅者收到事件后需要执行的方法
 public void ShowMsg(Heater obj, BoiledEventArgs e)
 {
     Console.WriteLine("Display recived event,temperature: {0} ,made by {1}", e.Tempareture, obj.Producer);
 }