示例#1
0
        public void OnBallInPlay(BallEventArgs e)
        {
            EventHandler ballInPlay = BallInPlay;

            if (ballInPlay != null)
            {
                ballInPlay(this, e);
            }
        }
示例#2
0
        public MainPage()
        {
            Ball          ball          = new Ball();
            Pitcher       pitcher       = new Pitcher(ball);
            BallEventArgs ballEventArgs = new BallEventArgs(50);

            ball.OnBallInPlay(ballEventArgs);

            this.InitializeComponent();
        }
示例#3
0
 private void Ball_BallInPlay(object sender, EventArgs e)
 {
     if (e is BallEventArgs)
     {
         BallEventArgs ballEventArgs = e as BallEventArgs;
         if (ballEventArgs.Trajectory < 60)
         {
             CatchBall();
         }
         else
         {
             CoverFirstBase();
         }
     }
 }