コード例 #1
0
        /// <summary>
        /// Executes the specified command
        /// </summary>
        /// <param name="command">The command to execute</param>
        /// <param name="commandArg">Optional arguments for the command</param>
        /// <param name="handled">set this to true if handled</param>
        public override void OnRunCommand(String command, object commandArg, ref bool handled)
        {
            handled = true;
            switch (command)
            {
            case "CmdSnapWindow":
                Windows.SetForegroundWindowSizePercent(Context.AppWindowPosition, Common.AppPreferences.WindowSnapSizePercent);
                break;

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

            case "CmdZoomIn":
                appTextInterface.Pause();
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Add);
                appTextInterface.Resume();
                break;

            case "CmdZoomOut":
                appTextInterface.Pause();
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Subtract);
                appTextInterface.Resume();
                break;

            case "CmdZoomFit":
                appTextInterface.Pause();
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D0);
                appTextInterface.Resume();
                break;

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

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

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

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

            case "IEWebSearch":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.E);
                break;

            case "IEFavorites":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.I);
                break;

            case "IEHistory":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.H);
                break;

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

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

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

            case "IEBrowserMenu":
                showPanel(this, new PanelRequestEventArgs("InternetExplorerBrowserMenu",
                                                          "IExplorer",
                                                          WindowActivityMonitor.GetForegroundWindowInfo(),
                                                          true));

                break;

            case "IEZoomMenu":
                showPanel(this, new PanelRequestEventArgs("InternetExplorerZoomMenu",
                                                          "IExplorer",
                                                          WindowActivityMonitor.GetForegroundWindowInfo(),
                                                          true));
                break;

            case "IEEmailLink":
                _explorerElements.EmailPageAsLink();
                break;

            case "NewTab":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.T);
                break;

            case "NextTab":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Tab);
                break;

            case "CloseTab":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.W);
                break;

            default:
                base.OnRunCommand(command, commandArg, ref handled);
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Invoked to run a command
        /// </summary>
        /// <param name="command">The command to execute</param>
        /// <param name="commandArg">Optional arguments for the command</param>
        /// <param name="handled">set this to true if handled</param>
        public override void OnRunCommand(String command, object commandArg, ref bool handled)
        {
            handled = true;
            switch (command)
            {
            case "CmdThreeFourthMaximizeWindow":
                Windows.SetForegroundWindowSizePercent(Context.AppWindowPosition, 75);
                break;

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

            case "CmdZoomIn":
                appTextInterface.Pause();
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Add);
                appTextInterface.Resume();
                break;

            case "CmdZoomOut":
                appTextInterface.Pause();
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Subtract);
                appTextInterface.Resume();
                break;

            case "CmdZoomFit":
                appTextInterface.Pause();
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D0);
                appTextInterface.Resume();
                break;

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

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

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

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

            case "IEWebSearch":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.E);
                break;

            case "IEFavorites":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.I);
                //AgentController.Instance.Send(Keys.BrowserFavorites);
                break;

            case "IEHistory":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.H);
                break;

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

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

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

            case "IEZoomMenu":
            {
                var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                var panelArg    = new PanelRequestEventArgs("InternetExplorerZoomMenu",
                                                            "IExplorer", monitorInfo)
                {
                    UseCurrentScreenAsParent = true
                };
                showPanel(this, panelArg);
            }

            break;

            case "IEEmailLink":
                _explorerElements.EmailPageAsLink();
                break;

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