一種在不一樣窗體之間進行消息廣播的方法spa
1 public class a{ 2 public static event OnEventHandle(string message); 3 4 private void Button_Click(){ 5 if(OnEventHandle!=null){ 6 OnEventHandle("hello word"); 7 } 8 } 9 } 10 public class b{ 11 public b(){ 12 a.OnEventHandle += (message)=>{ 13 console.write(message); 14 }; 15 } 16 }