ACAT.Extensions.Default.FunctionalAgents.LectureManager.LectureManagerAgent.OnRunCommand C# (CSharp) Method

OnRunCommand() public method

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
public OnRunCommand ( String command, object commandArg, bool &handled ) : void
command String command to run
commandArg object any optional arguments
handled bool was this handled?
return void
        public override void OnRunCommand(String command, object commandArg, ref bool handled)
        {
            handled = true;

            switch (command)
            {
                case "SpeakMenu":
                    if (isMainFormActive() && Confirm(Resources.SpeakNow))
                    {
                        var panel = (_lectureMgrForm.Mode == LectureManagerMainForm.SpeechMode.All) ? 
                                                SpeakAllMenu : 
                                                SpeakMenu ;

                        showPanel(this, new PanelRequestEventArgs(
                                                panel,
                                                Title,
                                                WindowActivityMonitor.GetForegroundWindowInfo(), true));
                    }

                    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(Resources.SetParagraphMode))
                        {
                            _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.Paragraph;
                            closeCurrentPanel();
                        }
                    }

                    break;

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

                    break;

                case "SpeechModeAll":
                    if (isMainFormActive())
                    {
                        if (Confirm(Resources.SetAll))
                        {
                            _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(Resources.SpeakingLeave))
                    {
                        closeCurrentPanel();
                        if (isMainFormActive())
                        {
                            _lectureMgrForm.StopIfSpeaking();
                        }
                    }

                    break;

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

                        _menuShown = false;
                    }

                    break;

                case "ToggleMode":
                    showPanel(this, new PanelRequestEventArgs("LectureManagerToggleModeMenu", 
                                                                Title,
                                                                WindowActivityMonitor.GetForegroundWindowInfo(), 
                                                                true));
                    break;

                case "NavigateMenu":
                    showPanel(this, new PanelRequestEventArgs("LectureManagerNavigationMenu", 
                                                                Title,
                                                                WindowActivityMonitor.GetForegroundWindowInfo(), 
                                                                true));
                    break;

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