public void Run(object sender, CatShoutEventArgs args) { Console.WriteLine("我是{0},{1}來了,快跑!\n", Name, args.Name); if (run != null) { MouseRunEventArgs e = new MouseRunEventArgs(); //宣告事件參數 e.Name = this.Name; run(this, e); //事件Run觸發, 通知所有登記過的物件,並將發送通知的自己this以及參數Args傳遞出去 } }
public void Catch(object sender, MouseRunEventArgs args) { Console.WriteLine("我是{0}! {1}別跑! \n", Name, args.Name); }