ACAT.Lib.Extension.AppAgents.Outlook.OutlookAgentBase.OnRunCommand C# (CSharp) Method

OnRunCommand() public method

Invoked to run a command from all the Outlook contextual menus
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;

            Log.Debug(command);
            switch (command)
            {
                case "GotoInbox":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D1);
                    break;

                case "ShowFolders":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Y);
                    break;

                case "GotoCalendar":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D2);
                    break;

                case "GotoContacts":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D3);
                    break;

                case "GotoTasks":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D4);
                    break;

                case "GotoNotes":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D5);
                    break;

                case "DeleteItem":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D);
                    break;

                case "NewItem":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.N);
                    break;

                case "OpenItem":
                    AgentManager.Instance.Keyboard.Send(Keys.Enter);
                    break;

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

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

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

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

                case "EmailReply":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.R);
                    break;

                case "EmailReplyAll":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.LShiftKey, Keys.R);
                    break;

                case "EmailForward":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.F);
                    break;

                case "EmailBrowseDelete":
                case "EmailInboxDelete":
                    if (DialogUtils.ConfirmScanner(ACATExtension.Resources.ConfirmDelete))
                    {
                        AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D);
                    }

                    break;

                case "EmailSelectField":
                    if (!actuateStandardControl(controlType))
                    {
                        var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                        showPanel(this, new PanelRequestEventArgs("Alphabet", monitorInfo));
                    }

                    break;

                case "NextField":
                    gotoNextField();
                    break;

                case "PreviousField":
                    gotoPreviousField();
                    break;

                case "EmailAttachFile":
                    attachFile();
                    break;

                case "EmailAttachments":
                    AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.A);
                    break;

                case "EmailSend":
                    if (DialogUtils.ConfirmScanner(ACATExtension.Resources.ConfirmSend))
                    {
                        AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.S);
                    }

                    break;

                case "EmailBrowseNext":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.OemPeriod);
                    break;

                case "EmailBrowsePrevious":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Oemcomma);
                    break;

                case "EmailClose":
                    AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.F4);
                    break;

                case "ApptSelectField":
                    if (!actuateStandardControl(controlType))
                    {
                        var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                        showPanel(this, new PanelRequestEventArgs("Alphabet", monitorInfo));
                    }

                    break;

                case "ApptPreviousField":
                    gotoPreviousField();
                    break;

                case "ApptNextField":
                    gotoNextField();
                    break;

                case "ApptAttendees":
                    AgentManager.Instance.Keyboard.Send(Keys.F10);
                    AgentManager.Instance.Keyboard.Send(Keys.H);
                    AgentManager.Instance.Keyboard.Send(Keys.U);
                    break;

                case "ApptAppointment":
                    AgentManager.Instance.Keyboard.Send(Keys.F10);
                    AgentManager.Instance.Keyboard.Send(Keys.H);
                    AgentManager.Instance.Keyboard.Send(Keys.P);
                    AgentManager.Instance.Keyboard.Send(Keys.P);
                    break;

                case "ApptSend":
                    if (DialogUtils.ConfirmScanner(ACATExtension.Resources.ConfirmSend))
                    {
                        AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.S);
                    }

                    break;

                case "ApptDelete":
                    if (DialogUtils.ConfirmScanner(ACATExtension.Resources.ConfirmDelete))
                    {
                        AgentManager.Instance.Keyboard.Send(Keys.F10);
                        AgentManager.Instance.Keyboard.Send(Keys.H);
                        AgentManager.Instance.Keyboard.Send(Keys.D);
                    }

                    break;

                case "ApptClose":
                    AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.F4);
                    break;

                case "ContactSelectField":
                    if (!actuateStandardControl(controlType))
                    {
                        var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                        showPanel(this, new PanelRequestEventArgs("Alphabet", monitorInfo));
                    }

                    break;

                case "ContactPreviousField":
                    gotoPreviousField();
                    break;

                case "ContactNextField":
                    gotoNextField();
                    break;

                case "ContactSave":
                    AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.S);
                    break;

                case "ContactDelete":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D);
                    break;

                case "ContactClose":
                    AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.F4);
                    break;

                case "TaskSelectField":
                    if (!actuateStandardControl(controlType))
                    {
                        var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                        showPanel(this, new PanelRequestEventArgs("Alphabet", monitorInfo));
                    }

                    break;

                case "TaskPreviousField":
                    gotoPreviousField();
                    break;

                case "TaskNextField":
                    gotoNextField();
                    break;

                case "TaskSave":
                    AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.S);
                    break;

                case "TaskDelete":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D);
                    break;

                case "TaskClose":
                    AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.F4);
                    break;

                case "Top":
                    AgentManager.Instance.Keyboard.Send(Keys.Home);
                    break;

                case "SwitchTo":
                    showPanel(this, new PanelRequestEventArgs("OutlookMailBoxesContextMenu",
                                                                "Switch To",
                                                                WindowActivityMonitor.GetForegroundWindowInfo(),
                                                                true));
                    break;

                case "EmailAction":
                    showPanel(this, new PanelRequestEventArgs("OutlookEmailActionContextMenu",
                                                            PanelTitle,
                                                            WindowActivityMonitor.GetForegroundWindowInfo(),
                                                            true));
                    break;

                case "AddressBook":
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.LShiftKey, Keys.B);
                    break;

                case "AddressBookSelectField":
                    if (!actuateStandardControl(controlType))
                    {
                        showPanel(this, new PanelRequestEventArgs("Alphabet", WindowActivityMonitor.GetForegroundWindowInfo()));
                    }

                    break;

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