コード例 #1
0
 /// <summary>
 /// If the player is the active one it will sets its <c>key</c> to <c>e.Key.key</c>.
 /// </summary>
 /// <param name="sender">The object that invoked the event.</param>
 /// <param name="e">The parameter containing the variables and their values of ControlEvents.</param>
 protected void KeyEventHandler(object sender, ControlEvents.KeyEventArgs e)
 {
     if (isActive)
     {
         key = e.Key;
     }
 }
コード例 #2
0
        /// <summary>
        /// Invokes the event RaiseKeyEvent.
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnKeyPress(ControlEvents.KeyEventArgs e)
        {
            keyEventHandler eventHandler = RaiseKeyEvent;

            if (eventHandler != null)
            {
                eventHandler.Invoke(this, e);
            }
        }