public void FlyAway(int incrmnt) { if (BirdFlewAway) { if (NotSeeing != null) { Birds_EventArgs ev = new Birds_EventArgs(); ev.BirdFlewAway = BirdFlewAway; ev.TimeReached = DateTime.Now; OnNotSeeing(ev); } } else { NormalSpeed += incrmnt; if ((crit_diff >= FlySpeed - NormalSpeed) && (Startle != null)) { Startle(this, new BirdEventsArgs(Nick.ToString() + " panic ...")); } if (NormalSpeed >= FlySpeed) { BirdFlewAway = true; } else { Console.WriteLine("... flying close with the speed = {0}", NormalSpeed); } } }
protected virtual void OnNotSeeing(Birds_EventArgs e) { if (NotSeeing != null) { NotSeeing(this, e); } }
protected virtual void OnNotSeeing(Birds_EventArgs e) { BirdEventsHandler_std handler = NotSeeing; if (handler != null) { handler(this, e); } }
static void My_Bird_NotSeeing(object sender, Birds_EventArgs e) { Console.WriteLine("End ... " + e.TimeReached); BirdFlewAwayException ex = new BirdFlewAwayException("Bird flew with incredible speed!", "Invisible...", DateTime.Now); ex.HelpLink = "http://www.example.com"; throw ex; }