title: How to create an EventHandler for a gamepad button press not in the update method
body: <p>I'm trying to add an event handler to a button press of a XNA gamepad using Microsoft Visual c#. I've tried putting a test for the button state to be pressed in the update method but since the update method is called like 60 times a second, it checks for the button press and is registered a bunch of times. IS THERE A WAY TO MAKE AN EVENT LISTENER FOR THE BUTTON TO BE PRESSED AND CALL THE EVENT ONCE INSTEAD OF A BUNCH OF TIMES?
  Here's my code in the update method that doesn't work:</p>
  
  <pre><code>    protected override void Update(GameTime gameTime)
      {
            if(GamePad.GetState(PlayerIndex.One).Buttons.Y == ButtonState.Pressed)
      {
                //do some code
            }
      }
  </code></pre>
  
  <p>this doesn't do what i need, can someone please point me in the right direction?</p>