Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            BallEventsArgs ballEvents = new BallEventsArgs(
                (int)this.numericUpDown1.Value, (int)this.numericUpDown2.Value);

            ball.OnBallInPlay(ballEvents);
        }
Beispiel #2
0
            public void OnBallInPlay(BallEventsArgs e)
            {
                EventHandler ballInPlay = BallInPlay;

                if (ballInPlay != null)
                {
                    ballInPlay(this, e);
                }
            }
Beispiel #3
0
            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!");
                    }
                }
            }
Beispiel #4
0
            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!");
                    }
                }
            }