private void button1_Click(object sender, EventArgs e) { BallEventsArgs ballEvents = new BallEventsArgs( (int)this.numericUpDown1.Value, (int)this.numericUpDown2.Value); ball.OnBallInPlay(ballEvents); }
public void OnBallInPlay(BallEventsArgs e) { EventHandler ballInPlay = BallInPlay; if (ballInPlay != null) { ballInPlay(this, e); } }
public void Ball_BallInPlay(object sender, EventArgs e) { if (e is BallEventsArgs) { BallEventsArgs ballEvents = e as BallEventsArgs; if (ballEvents.Trajectory < 30 || ballEvents.Distance < 90) { Console.WriteLine("Pitcher: I caught the ball!"); } else { Console.WriteLine("Pitcher: Just a little!"); } } }
public void Ball_BallInPlay(object sender, EventArgs e) { if (e is BallEventsArgs) { BallEventsArgs ballEvents = e as BallEventsArgs; if (ballEvents.Trajectory > 30 || ballEvents.Distance > 90) { Console.WriteLine("Fan: Go Home! Let me going for the ball!"); } else { Console.WriteLine("Fan: Woo-hoo Yeah!"); } } }