Ejemplo n.º 1
0
        private void Browse_KeyDown(object sender, KeyEventArgs e)
        {
            const int PAGE_JUMP = 7;

            //handle changing timer interval settings
            if (bAuto && e.Modifiers == Keys.Shift) {
                if (e.KeyCode == Keys.Oemplus) {
                    bAuto = true;
                    Console.Beep(700, 100);
                    trFlip.Interval += 500;
                    Tmr_Reset();
                }
                else if (e.KeyCode == Keys.OemMinus) {
                    if (trFlip.Interval >= 1500) {
                        bAuto = true;
                        Console.Beep(100, 100);
                        trFlip.Interval -= 500;
                        Tmr_Reset();
                    }
                }
                return;
            }

            switch (e.KeyCode) {
                #region Traversal

                case Keys.Left:
                case Keys.A:
                    Next();
                    break;

                case Keys.Right:
                case Keys.D:
                    Prev();
                    break;

                case Keys.Up:
                    if ((Page += PAGE_JUMP) > Files.Count)
                        Page = Page - Files.Count;
                    Next();
                    break;

                case Keys.Down:
                    if ((Page -= PAGE_JUMP) < 0)
                        Page = Files.Count + Page;
                    Prev();
                    break;

                case Keys.Home:
                    Page = -1;
                    Next();
                    break;

                case Keys.End:
                    Page = Files.Count + 1;
                    Prev();
                    break;

                #endregion Traversal

                #region Special Functions

                case Keys.F:
                    if (bAuto)
                        trFlip.Stop();
                    Cursor.Show();

                    using (PageBrowser fmGoTo = new PageBrowser(this)) {
                        fmGoTo.iPage = (bWideR || bWideL) ? Page : Page - 1;
                        fmGoTo.StartPosition = FormStartPosition.CenterScreen;
                        bValidFocusLost = true;

                        if (fmGoTo.ShowDialog() == DialogResult.OK) {
                            Page = fmGoTo.iPage - 1;
                            Next();
                        }
                    }

                    if (bAuto)
                        trFlip.Start();
                    Select();
                    Cursor.Hide();
                    break;

                case Keys.S:
                    bAuto = !bAuto;
                    if (bAuto) {
                        Console.Beep(500, 100);
                        trFlip.Start();
                    }
                    else {
                        Console.Beep(300, 100);
                        trFlip.Stop();
                    }
                    break;

                #endregion Special Functions

                #region Ignored Keys

                case Keys.PrintScreen:
                case Keys.MediaNextTrack:
                case Keys.MediaPreviousTrack:
                case Keys.MediaPlayPause:
                case Keys.MediaStop:
                case Keys.VolumeUp:
                case Keys.VolumeDown:
                case Keys.VolumeMute:
                case Keys.LWin:
                case Keys.RWin:
                    break;

                #endregion Ignored Keys

                default:
                    Close();
                    break;
            }
        }
Ejemplo n.º 2
0
        private void Browse_KeyDown(object sender, KeyEventArgs e)
        {
            const int PAGE_JUMP = 7;

            //handle changing timer interval settings
            if (bAuto && e.Modifiers == Keys.Shift)
            {
                if (e.KeyCode == Keys.Oemplus)
                {
                    bAuto = true;
                    Console.Beep(700, 100);
                    trFlip.Interval += 500;
                    Tmr_Reset();
                }
                else if (e.KeyCode == Keys.OemMinus)
                {
                    if (trFlip.Interval >= 1500)
                    {
                        bAuto = true;
                        Console.Beep(100, 100);
                        trFlip.Interval -= 500;
                        Tmr_Reset();
                    }
                }
                return;
            }

            switch (e.KeyCode)
            {
                #region Traversal

            case Keys.Left:
            case Keys.A:
                Next();
                break;

            case Keys.Right:
            case Keys.D:
                Prev();
                break;

            case Keys.Up:
                if ((Page += PAGE_JUMP) > Files.Count)
                {
                    Page = Page - Files.Count;
                }
                Next();
                break;

            case Keys.Down:
                if ((Page -= PAGE_JUMP) < 0)
                {
                    Page = Files.Count + Page;
                }
                Prev();
                break;

            case Keys.Home:
                Page = -1;
                Next();
                break;

            case Keys.End:
                Page = Files.Count + 1;
                Prev();
                break;

                #endregion Traversal

                #region Special Functions

            case Keys.F:
                if (bAuto)
                {
                    trFlip.Stop();
                }
                Cursor.Show();

                using (PageBrowser fmGoTo = new PageBrowser(this)) {
                    fmGoTo.iPage         = (bWideR || bWideL) ? Page : Page - 1;
                    fmGoTo.StartPosition = FormStartPosition.CenterScreen;
                    bValidFocusLost      = true;

                    if (fmGoTo.ShowDialog() == DialogResult.OK)
                    {
                        Page = fmGoTo.iPage - 1;
                        Next();
                    }
                }

                if (bAuto)
                {
                    trFlip.Start();
                }
                Select();
                Cursor.Hide();
                break;

            case Keys.S:
                bAuto = !bAuto;
                if (bAuto)
                {
                    Console.Beep(500, 100);
                    trFlip.Start();
                }
                else
                {
                    Console.Beep(300, 100);
                    trFlip.Stop();
                }
                break;

                #endregion Special Functions

                #region Ignored Keys

            case Keys.PrintScreen:
            case Keys.MediaNextTrack:
            case Keys.MediaPreviousTrack:
            case Keys.MediaPlayPause:
            case Keys.MediaStop:
            case Keys.VolumeUp:
            case Keys.VolumeDown:
            case Keys.VolumeMute:
            case Keys.LWin:
            case Keys.RWin:
                break;

                #endregion Ignored Keys

            default:
                Close();
                break;
            }
        }