Пример #1
0
        public void OnBallInPlay(BallEventArgs e)
        {
            EventHandler ballInPlay = BallInPlay;

            if (ballInPlay != null)
            {
                ballInPlay(this, e);
            }
        }
Пример #2
0
 void ball_BallInPlay(object sender, EventArgs e)
 {
     if (e is BallEventArgs)
     {
         BallEventArgs ballEventArgs = e as BallEventArgs;
         if ((ballEventArgs.Distance < 95) && (ballEventArgs.Trajectory < 60))
         {
             CatchBall();
         }
         else
         {
             CoverFirstBase();
         }
     }
 }
Пример #3
0
 void ball_BallInPlay(object sender, EventArgs e)
 {
     if (e is BallEventArgs)
     {
         BallEventArgs ballEventArgs = e as BallEventArgs;
         if ((ballEventArgs.Distance > 400) && (ballEventArgs.Trajectory > 30))
         {
             Console.WriteLine("Fan: Home run! I'm going for the ball!!");
         }
         else
         {
             Console.WriteLine("Fan: Woo-hoo! Yeah!");
         }
     }
 }