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

            if (ballInPlay != null)
            {
                ballInPlay(this, e);
            }
        }
コード例 #2
0
        // subscribe method of event handler for BallInPlay
        void ball_BallInPlay(object sender, EventArgs e)
        {
            // Check state event for BallEvent
            if (e is BallEventArgs)
            {
                BallEventArgs ballEventArgs = e as BallEventArgs;

                if ((ballEventArgs.Trajectory < 95) &&
                    (ballEventArgs.Distance < 60))
                {
                    Console.WriteLine("Trajectory < 90 and Distance < 60");
                }
                else
                {
                    Console.WriteLine("not Trajectory < 90 and Distance < 60");
                }
            }
        }