ACAT.Lib.Extension.AppAgents.MSWord.MSWordAgentBase.OnRunCommand C# (CSharp) Method

OnRunCommand() public method

Executes the specified command
public OnRunCommand ( String command, object commandArg, bool &handled ) : void
command String The command to execute
commandArg object Optional arguments for the command
handled bool set this to true if handled
return void
        public override void OnRunCommand(String command, object commandArg, ref bool handled)
        {
            handled = true;
            switch (command)
            {
                case "MenuContextClose":
                    AgentManager.Instance.Keyboard.Send(Keys.Escape);
                    AgentManager.Instance.Keyboard.Send(Keys.Escape);
                    AgentManager.Instance.Keyboard.Send(Keys.Escape);
                    break;

                case "SwitchAppWindow":
                    DialogUtils.ShowTaskSwitcher(MSWordProcessName);
                    break;

                case "CmdZoomIn":
                    if (_textInterface is MSWordTextControlAgent)
                    {
                        var textAgent = _textInterface as MSWordTextControlAgent;
                        textAgent.ZoomIn();
                    }

                    break;

                case "CmdZoomOut":
                    if (_textInterface is MSWordTextControlAgent)
                    {
                        var textAgent = _textInterface as MSWordTextControlAgent;
                        textAgent.ZoomOut();
                    }

                    break;

                case "CmdZoomFit":
                    if (_textInterface is MSWordTextControlAgent)
                    {
                        var textAgent = _textInterface as MSWordTextControlAgent;
                        textAgent.ZoomFit();
                    }

                    break;

                case "OpenRecentFile":
                    AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.F, Keys.R);
                    AgentManager.Instance.Keyboard.Send(Keys.Tab);
                    break;

                case "SaveAs":
                    AgentManager.Instance.Keyboard.Send(Keys.F12);
                    break;

                case "SaveFile":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.S);
                    //DialogUtils.Toast("Saved");
                    break;

                case "MSWordLectureManager":
                    if (_textInterface is MSWordTextControlAgent)
                    {
                        var textAgent = (MSWordTextControlAgent)_textInterface;
                        var text = textAgent.GetTextFromDocument();
                        if (String.IsNullOrEmpty(text.Trim()))
                        {
                            DialogUtils.ShowTimedDialog(PanelManager.Instance.GetCurrentPanel() as Form,
                                                        ACATExtension.Resources.LectureManager, ACATExtension.Resources.DocumentIsEmpty);
                            break;
                        }

                        if (DialogUtils.ConfirmScanner(ACATExtension.Resources.LoadThisDocumentIntoLectureManager))
                        {
                            launchLectureManager(textAgent.GetFileName(), text);
                        }
                    }

                    break;

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