public void FlyAway(int incrmnt) { if (birdFlewAway) { if (NotSeeing != null) { BirdEventsArgs ev = new BirdEventsArgs("Птица улетает"); 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); } }
static void My_Bird_NotSeeing(object sender, BirdEventsArgs 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; }
static void My_Bird_Startle(object sender, BirdEventsArgs e) { // throw new NotImplementedException(); Console.WriteLine("Oh ... " + e.eventString); }
protected virtual void OnNotSeeing(BirdEventsArgs e) { NotSeeing?.Invoke(this, e); }