public void Release( bool doPress ) { //if( _repeatCount < 0 ) //{ //This case can happen without any "bugs" as running on a slow computer or clicking with both the mouse and the trackpad can //send a push/push -> release/release sequence. //Throwing an exception here is not the right answer. //The repeatcount seems therefor rather useless. //throw new InvalidOperationException( R.KeyReleaseWhenUp ); //} if( doPress ) OnKeyPressed(); _repeatCount = -1; // Last event: KeyUp KeyInteractionEventArgs e = new KeyInteractionEventArgs( this, Current.OnKeyUpCommands, KeyInteractionEventType.Up ); EventHandler<KeyInteractionEventArgs> keyUp = KeyUp; if( keyUp != null ) keyUp( this, e ); Keyboard.OnKeyUp( e ); }
/// <summary> /// Redirects the command to the method which will process it. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void SendKeyCommand( object sender, KeyInteractionEventArgs e ) { SendCommands( e.Key, e.Commands ); }
public void Push() { //if( _repeatCount >= 0 ) //{ //This case can happen without any "bugs" as running on a slow computer or clicking with both the mouse and the trackpad can //send a push/push -> release/release sequence. //Throwing an exception here is not the right answer. //The repeatcount seems therefor rather useless. //throw new InvalidOperationException( R.KeyPushWhenDown ); //} //Debug.Assert( _repeatCount == -1, "Since Push has not been called yet, repeatCount must be -1." ); _repeatCount = 0; KeyInteractionEventArgs e = new KeyInteractionEventArgs( this, Current.OnKeyDownCommands, KeyInteractionEventType.Down ); EventHandler<KeyInteractionEventArgs> keyDown = KeyDown; if( keyDown != null ) keyDown( this, e ); Keyboard.OnKeyDown( e ); }