Inheritance: System.EventArgs
Example #1
0
 protected virtual void OnKeyDown(KeyCodeEventArgs e)
 {
     if (KeyDownEvent != null)
     {
         KeyDownEvent(this, e);
     }
 }
 protected virtual void OnKeyDown(KeyCodeEventArgs e)
 {
     if (KeyDownEvent != null)
     {
         KeyDownEvent(this, e);
     }
 }
        private void KeyboardHook(object sender, KeyCodeEventArgs e)
        {
            if (!NotFocusedOnTextbox) return;

            switch (e.KeyCode)
            {
                case Keys.Left:
                    if ((ModifierKeys & Keys.Shift) != 0) return;
                    if (mp.CurrentStatus.Duration - 5 > -1)
                        mp.Seek(mp.CurrentStatus.Duration - 5);
                    else //if (mplayer.currentPosition < 5)
                        mp.Seek(0);
                    break;
                case Keys.Right:
                    if ((ModifierKeys & Keys.Shift) != 0) return;
                    if (mp.CurrentStatus.Duration + 5 < mp.CurrentStatus.TotalLength)
                        mp.Seek(mp.CurrentStatus.Duration + 5);
                    else
                        playlist.PlayNext();
                    break;
                case Keys.PageUp:
                    mp.PreviousChapter();
                    break;
                case Keys.PageDown:
                    mp.NextChapter();
                    break;
                case Keys.MediaNextTrack:
                    playlist.PlayNext();
                    break;
                case Keys.MediaPreviousTrack:
                    playlist.PlayPrevious();
                    break;
                case Keys.MediaStop:
                    mp.Stop();
                    break;
                case Keys.MediaPlayPause:
                    switch (mp.CurrentStatus.PlayState)
                    {
                        case PlayStates.Playing:
                            mp.Pause(false);
                            break;
                        case PlayStates.Paused:
                        case PlayStates.Stopped:
                            mp.Pause(true);
                            break;
                    }
                    break;
            }
        }