Exemple #1
0
        public void UIKeyListener(object sender, HotKey key)
        {
            KeyAction action;

            try {
                action = Config.Hotkeys.ActionsHotkeys.GetKeyByValue(key);
            } catch (Exception ex) {
                /* The dictionary contains 2 equal values for different keys */
                Log.Exception(ex);
                return;
            }

            if (action != KeyAction.None && analysisWindow != null)
            {
                switch (action)
                {
                case KeyAction.ZoomIn:
                    analysisWindow.ZoomIn();
                    return;

                case KeyAction.ZoomOut:
                    analysisWindow.ZoomOut();
                    return;

                case KeyAction.ShowDashboard:
                    analysisWindow.ShowDashboard();
                    return;

                case KeyAction.ShowTimeline:
                    analysisWindow.ShowTimeline();
                    return;

                case KeyAction.ShowPositions:
                    analysisWindow.ShowZonalTags();
                    return;

                case KeyAction.FitTimeline:
                    analysisWindow.FitTimeline();
                    return;
                }

                if (projectType == ProjectType.CaptureProject ||
                    projectType == ProjectType.FakeCaptureProject ||
                    projectType == ProjectType.URICaptureProject)
                {
                    switch (action)
                    {
                    case KeyAction.PauseClock:
                        if (capturer.Capturing)
                        {
                            capturer.PausePeriod();
                        }
                        else
                        {
                            capturer.ResumePeriod();
                        }
                        break;

                    case KeyAction.StartPeriod:
                        capturer.StartPeriod();
                        break;

                    case KeyAction.StopPeriod:
                        capturer.StopPeriod();
                        break;
                    }
                }
            }
        }
        public void UIKeyListener(KeyPressedEvent e)
        {
            KeyAction action;

            try {
                action = App.Current.Config.Hotkeys.ActionsHotkeys.GetKeyByValue(e.Key);
            } catch (Exception ex) {
                /* The dictionary contains 2 equal values for different keys */
                Log.Exception(ex);
                return;
            }

            if (action != KeyAction.None)
            {
                /*	if (analysisWindow != null) {
                 *              switch (action) {
                 *              case KeyAction.ZoomIn:
                 *                      analysisWindow.ZoomIn ();
                 *                      return;
                 *              case KeyAction.ZoomOut:
                 *                      analysisWindow.ZoomOut ();
                 *                      return;
                 *              case KeyAction.ShowDashboard:
                 *                      analysisWindow.ShowDashboard ();
                 *                      return;
                 *              case KeyAction.ShowTimeline:
                 *                      analysisWindow.ShowTimeline ();
                 *                      return;
                 *              case KeyAction.ShowPositions:
                 *                      analysisWindow.ShowZonalTags ();
                 *                      return;
                 *              case KeyAction.FitTimeline:
                 *                      analysisWindow.FitTimeline ();
                 *                      return;
                 *              }
                 *      }*/

                if (projectType == ProjectType.CaptureProject ||
                    projectType == ProjectType.FakeCaptureProject ||
                    projectType == ProjectType.URICaptureProject)
                {
                    switch (action)
                    {
                    case KeyAction.PauseClock:
                        if (capturer.Capturing)
                        {
                            capturer.PausePeriod();
                        }
                        else
                        {
                            capturer.ResumePeriod();
                        }
                        break;

                    case KeyAction.StartPeriod:
                        capturer.StartPeriod();
                        break;

                    case KeyAction.StopPeriod:
                        capturer.StopPeriod();
                        break;
                    }
                }
                else
                {
                    switch (action)
                    {
                    case KeyAction.FrameUp:
                        player.SeekToNextFrame();
                        return;

                    case KeyAction.FrameDown:
                        player.SeekToPreviousFrame();
                        return;

                    case KeyAction.JumpUp:
                        player.StepForward();
                        return;

                    case KeyAction.JumpDown:
                        player.StepBackward();
                        return;

                    case KeyAction.DrawFrame:
                        player.DrawFrame();
                        return;

                    case KeyAction.TogglePlay:
                        player.TogglePlay();
                        return;

                    case KeyAction.SpeedUp:
                        player.FramerateUp();
                        App.Current.EventsBroker.Publish <PlaybackRateChangedEvent> (
                            new PlaybackRateChangedEvent {
                            Value = (float)player.Rate
                        }
                            );
                        return;

                    case KeyAction.SpeedDown:
                        player.FramerateDown();
                        App.Current.EventsBroker.Publish <PlaybackRateChangedEvent> (
                            new PlaybackRateChangedEvent {
                            Value = (float)player.Rate
                        }
                            );
                        return;

                    case KeyAction.CloseEvent:
                        App.Current.EventsBroker.Publish <LoadEventEvent> (new LoadEventEvent());
                        return;

                    case KeyAction.Prev:
                        player.Previous();
                        return;

                    case KeyAction.Next:
                        player.Next();
                        return;

                    case KeyAction.SpeedUpper:
                        player.FramerateUpper();
                        return;

                    case KeyAction.SpeedLower:
                        player.FramerateLower();
                        return;
                    }
                }
            }
        }