Example #1
0
        public override void OnRunCommand(String command, object commandArg, ref bool handled)
        {
            handled = true;

            switch (command)
            {
            case "SpeakMenu":
                if (isMainFormActive())
                {
                    if (Confirm("Speak now?"))
                    {
                        if (_lectureMgrForm.Mode == LectureManagerMainForm.SpeechMode.All)
                        {
                            var arg2 = new PanelRequestEventArgs(SpeakAllMenuPanel, _title, WindowActivityMonitor.GetForegroundWindowInfo());
                            arg2.UseCurrentScreenAsParent = true;
                            showPanel(this, arg2);
                        }
                        else
                        {
                            var arg2 = new PanelRequestEventArgs(SpeakMenuPanel, _title, WindowActivityMonitor.GetForegroundWindowInfo());
                            arg2.UseCurrentScreenAsParent = true;
                            showPanel(this, arg2);
                        }
                    }
                }

                break;

            case "LMTopOfDoc":
                if (isMainFormActive())
                {
                    _lectureMgrForm.GoToTop();
                }

                break;

            case "LMForward":
                if (isMainFormActive())
                {
                    _lectureMgrForm.NavigateForward();
                }

                break;

            case "LMBackward":
                if (isMainFormActive())
                {
                    _lectureMgrForm.NavigateBackward();
                }

                break;

            case "SpeechModeParagraph":
                if (isMainFormActive())
                {
                    if (Confirm("Set Paragraph Mode?"))
                    {
                        _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.Paragraph;
                        closeCurrentPanel();
                    }
                }

                break;

            case "SpeechModeSentence":
                if (isMainFormActive())
                {
                    if (Confirm("Set Sentence Mode?"))
                    {
                        _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.Sentence;
                        closeCurrentPanel();
                    }
                }

                break;

            case "SpeechModeAll":
                if (isMainFormActive())
                {
                    if (Confirm("Set All?"))
                    {
                        _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.All;
                        closeCurrentPanel();
                    }
                }

                break;

            case "SpeakNext":
                if (isMainFormActive())
                {
                    _lectureMgrForm.ProcessSpeakNext();
                }

                break;

            case "SpeakAll":
                if (isMainFormActive())
                {
                    if (_lectureMgrForm.Speaking)
                    {
                        _lectureMgrForm.PauseSpeaking();
                    }
                    else
                    {
                        _lectureMgrForm.ProcessReadAllSpeech();
                    }
                }

                break;

            case "leaveSpeak":
                if (Confirm("Speaking. Leave?"))
                {
                    closeCurrentPanel();
                    if (isMainFormActive())
                    {
                        _lectureMgrForm.StopIfSpeaking();
                    }
                }

                break;

            case "exitLectureManager":
                if (Confirm("Exit Lecture Manager?"))
                {
                    closeCurrentPanel();
                    if (_lectureMgrForm != null)
                    {
                        Windows.CloseForm(_lectureMgrForm);
                        _lectureMgrForm = null;
                    }

                    Close();
                }

                break;

            case "ToggleMode":
                PanelRequestEventArgs arg21 = new PanelRequestEventArgs("LectureManagerToggleModeMenu", _title, WindowActivityMonitor.GetForegroundWindowInfo());
                arg21.UseCurrentScreenAsParent = true;
                showPanel(this, arg21);
                break;

            case "NavigateMenu":
                PanelRequestEventArgs arg1 = new PanelRequestEventArgs("LectureManagerNavigationMenu", _title, WindowActivityMonitor.GetForegroundWindowInfo());
                arg1.UseCurrentScreenAsParent = true;
                showPanel(this, arg1);
                break;

            default:
                base.OnRunCommand(command, commandArg, ref handled);
                break;
            }
        }
Example #2
0
        /// <summary>
        /// Invoked when there is a request to run a command. This
        /// could as a result of the user activating a button on the
        /// scanner and there is a command associated with the button
        /// </summary>
        /// <param name="command">command to run</param>
        /// <param name="commandArg">any optional arguments</param>
        /// <param name="handled">was this handled?</param>
        public override void OnRunCommand(String command, object commandArg, ref bool handled)
        {
            handled = true;

            switch (command)
            {
            case "SpeakMenu":
                if (isMainFormActive())
                {
                    if (Confirm("Speak now?"))
                    {
                        PanelRequestEventArgs speakArg;
                        if (_lectureMgrForm.Mode == LectureManagerMainForm.SpeechMode.All)
                        {
                            speakArg = new PanelRequestEventArgs(
                                SpeakAllMenuPanel,
                                Title,
                                WindowActivityMonitor.GetForegroundWindowInfo())
                            {
                                UseCurrentScreenAsParent = true
                            };

                            showPanel(this, speakArg);
                        }
                        else
                        {
                            speakArg = new PanelRequestEventArgs(
                                SpeakMenuPanel,
                                Title,
                                WindowActivityMonitor.GetForegroundWindowInfo())
                            {
                                UseCurrentScreenAsParent = true
                            };

                            showPanel(this, speakArg);
                        }
                    }
                }

                break;

            case "LMTopOfDoc":
                if (isMainFormActive())
                {
                    _lectureMgrForm.GoToTop();
                }

                break;

            case "LMForward":
                if (isMainFormActive())
                {
                    _lectureMgrForm.NavigateForward();
                }

                break;

            case "LMBackward":
                if (isMainFormActive())
                {
                    _lectureMgrForm.NavigateBackward();
                }

                break;

            case "SpeechModeParagraph":
                if (isMainFormActive())
                {
                    if (Confirm("Set Paragraph Mode?"))
                    {
                        _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.Paragraph;
                        closeCurrentPanel();
                    }
                }

                break;

            case "SpeechModeSentence":
                if (isMainFormActive())
                {
                    if (Confirm("Set Sentence Mode?"))
                    {
                        _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.Sentence;
                        closeCurrentPanel();
                    }
                }

                break;

            case "SpeechModeAll":
                if (isMainFormActive())
                {
                    if (Confirm("Set All?"))
                    {
                        _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.All;
                        closeCurrentPanel();
                    }
                }

                break;

            case "SpeakNext":
                if (isMainFormActive())
                {
                    _lectureMgrForm.ProcessSpeakNext();
                }

                break;

            case "SpeakAll":
                if (isMainFormActive())
                {
                    if (_lectureMgrForm.Speaking)
                    {
                        _lectureMgrForm.PauseSpeaking();
                    }
                    else
                    {
                        _lectureMgrForm.ProcessReadAllSpeech();
                    }
                }

                break;

            case "leaveSpeak":
                if (Confirm("Speaking. Leave?"))
                {
                    closeCurrentPanel();
                    if (isMainFormActive())
                    {
                        _lectureMgrForm.StopIfSpeaking();
                    }
                }

                break;

            case "exitLectureManager":
                if (Confirm("Exit Lecture Manager?"))
                {
                    closeCurrentPanel();
                    if (_lectureMgrForm != null)
                    {
                        Windows.CloseForm(_lectureMgrForm);
                        _lectureMgrForm = null;
                    }
                    Context.AppWindowPosition = _prevScannerPosition;
                    Close();
                    Log.Debug("setting _menushown to false ");

                    _menuShown = false;
                }

                break;

            case "ToggleMode":
                var toggleModeArg = new PanelRequestEventArgs("LectureManagerToggleModeMenu", Title,
                                                              WindowActivityMonitor.GetForegroundWindowInfo())
                {
                    UseCurrentScreenAsParent = true
                };
                showPanel(this, toggleModeArg);
                break;

            case "NavigateMenu":
                var navigateMenuArg = new PanelRequestEventArgs("LectureManagerNavigationMenu", Title,
                                                                WindowActivityMonitor.GetForegroundWindowInfo())
                {
                    UseCurrentScreenAsParent = true
                };
                showPanel(this, navigateMenuArg);
                break;

            default:
                base.OnRunCommand(command, commandArg, ref handled);
                break;
            }
        }