Exemplo n.º 1
0
        /// <summary>
        /// Invoked when the focus changes either in the active window or when the
        /// active window itself changes.
        /// </summary>
        /// <param name="monitorInfo">Info about focused element</param>
        /// <param name="handled">was this handled</param>
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug("OnFocus: " + monitorInfo.ToString());

            base.OnFocusChanged(monitorInfo, ref handled);

            var handle = IntPtr.Zero;

            if (_form != null)
            {
                _form.Invoke(new MethodInvoker(delegate()
                {
                    handle = _form.Handle;
                }));
            }

            // if the abbreviations scanner is up, display the
            // alphabet scanner
            if (handle != IntPtr.Zero && monitorInfo.FgHwnd == handle)
            {
                if (!_scannerShown)
                {
                    var arg = new PanelRequestEventArgs(PanelClasses.AlphabetMinimal, monitorInfo)
                    {
                        RequestArg  = _form,
                        TargetPanel = _form,
                        UseCurrentScreenAsParent = true
                    };
                    showPanel(this, arg);
                    _scannerShown = true;
                }
            }

            handled = true;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Raises an event to request for displaying the specified
 /// scanner in 'arg'.
 /// </summary>
 /// <param name="sender">event source</param>
 /// <param name="arg">event arg</param>
 protected void showPanel(object sender, PanelRequestEventArgs arg)
 {
     if (EvtPanelRequest != null)
     {
         EvtPanelRequest.Invoke(this, arg);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Invoked when the focus changes either in the active window or when the
        /// active window itself changes.
        /// </summary>
        /// <param name="monitorInfo">Info about focused element</param>
        /// <param name="handled">was this handled</param>
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug("OnFocus: " + monitorInfo.ToString());

            base.OnFocusChanged(monitorInfo, ref handled);

            setTextInterface(textInterface);

            if (_menuShown)
            {
                return;
            }

            var arg = new PanelRequestEventArgs(PanelClasses.None, monitorInfo);

            handled = getLectureManagerPanel(arg);

            Log.Debug("handled: " + handled);

            if (handled)
            {
                _menuShown = true;
                Log.Debug("calling showpanel for : " + arg.PanelClass);

                showPanel(this, arg);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Displays the scanner that is appropriate for the element in focus
        /// </summary>
        /// <param name="monitorInfo">Foreground window info</param>
        /// <param name="handled">set to true if handled</param>
        private void autoDisplayScanner(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            handled = true;
            if (_explorerElements.IsFavoritesWindow(monitorInfo.FocusedElement) ||
                _explorerElements.IsHistoryWindow(monitorInfo.FocusedElement) ||
                _explorerElements.IsFeedsWindow(monitorInfo.FocusedElement))
            {
                if (!_scannerType.HasFlag(ScannerType.Favorites))
                {
                    var args = new PanelRequestEventArgs(PanelClasses.MenuContextMenu, ScannerTitle, monitorInfo)
                    {
                        UseCurrentScreenAsParent = true
                    };

                    showPanel(this, args);
                    _scannerType = ScannerType.Favorites;
                }
            }
            else if (_explorerElements.IsSearchControl(monitorInfo.FocusedElement) ||
                     _explorerElements.IsFindControl(monitorInfo.FocusedElement) ||
                     _explorerElements.IsAddressWindow(monitorInfo.FocusedElement))
            {
                if (!_scannerType.HasFlag(ScannerType.Address))
                {
                    showPanel(this, new PanelRequestEventArgs(PanelClasses.Alphabet, monitorInfo));
                    _scannerType = ScannerType.Address;
                }
            }
            else if (!_scannerType.HasFlag(ScannerType.Other))
            {
                showPanel(this, new PanelRequestEventArgs("InternetExplorerContextMenu", ScannerTitle, monitorInfo));
                _scannerType = ScannerType.Other;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Invoked when there is a request to display a contextual
        /// menu
        /// </summary>
        /// <param name="monitorInfo">foreground window info</param>
        public override void OnContextMenuRequest(WindowActivityMonitorInfo monitorInfo)
        {
            var arg = new PanelRequestEventArgs(PanelClasses.None, monitorInfo);

            getLectureManagerPanel(arg);

            showPanel(this, arg);
        }
Exemplo n.º 6
0
        void showWindowsExplorerScanner(String panel)
        {
            WindowActivityMonitorInfo monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
            PanelRequestEventArgs     panelArg    = new PanelRequestEventArgs(panel, monitorInfo);

            panelArg.Title = "Explorer";
            panelArg.UseCurrentScreenAsParent = true;
            showPanel(this, panelArg);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Dispays the menu indicated by the menu name
        /// </summary>
        /// <param name="menuName">name of the menu</param>
        /// <param name="title">Title of the menu</param>
        private void showMenu(String menuName, String title)
        {
            var panelArg = new PanelRequestEventArgs(menuName, title, WindowActivityMonitor.GetForegroundWindowInfo())
            {
                UseCurrentScreenAsParent = true
            };

            showPanel(this, panelArg);
        }
Exemplo n.º 8
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 "SwitchAppWindow":
                DialogUtils.ShowTaskSwitcher(ReaderProcessName);
                break;

            case "FoxitZoomMenu":
            {
                var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                var panelArg    = new PanelRequestEventArgs("FoxitReaderZoomMenu", "Foxit", monitorInfo)
                {
                    UseCurrentScreenAsParent = true
                };

                showPanel(this, panelArg);
            }

            break;

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

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

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

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

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

            default:
                base.OnRunCommand(command, commandArg, ref handled);
                break;
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Show the contexual menus for menus
        /// </summary>
        /// <param name="monitorInfo">Foreground menu window information</param>
        private void showMenuContextMenu(WindowActivityMonitorInfo monitorInfo)
        {
            var args = new PanelRequestEventArgs(PanelClasses.MenuContextMenu, monitorInfo)
            {
                UseCurrentScreenAsParent = true,
                Title = "Menu"
            };

            showPanel(this, args);
            scannerShown = true;
        }
        public override bool OnQueryPanelChange(PanelRequestEventArgs arg)
        {
            Log.Debug("Query change for " + arg.PanelClass);
            if (arg.MonitorInfo.FgHwnd == startupArg.HWnd)// && panelClass == PanelClasses.WindowsExplorerContextMenu)
            {
                if (PanelConfigMap.AreEqual(arg.PanelClass, "MenuAutoScanContextMenu"))
                    return true;
                Log.Debug("Refuse Query change for " + arg.PanelClass);
                return false;
            }

            return true;
        }
Exemplo n.º 11
0
 /// <summary>
 /// Event handler to display the alphabet scanner
 /// </summary>
 /// <param name="sender">event sender</param>
 /// <param name="eventArgs">event args</param>
 private void launchAppScanner_EvtShowScanner(object sender, EventArgs eventArgs)
 {
     if (_launchAppScanner != null)
     {
         var arg = new PanelRequestEventArgs(PanelClasses.AlphabetMinimal, WindowActivityMonitor.GetForegroundWindowInfo())
         {
             TargetPanel = _launchAppScanner,
             RequestArg  = _launchAppScanner,
             UseCurrentScreenAsParent = true
         };
         showPanel(this, arg);
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// Invoked when the focus changes either in the active window or when the
        /// active window itself changes.
        /// </summary>
        /// <param name="monitorInfo">Info about focused element</param>
        /// <param name="handled">was this handled</param>
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug("OnFocus: " + monitorInfo.ToString());

            base.OnFocusChanged(monitorInfo, ref handled);
            Log.Debug("menuShown: " + _scannerShown + ", title: " + monitorInfo.Title);
            if (!_scannerShown && monitorInfo.Title == "Create New File")
            {
                var arg = new PanelRequestEventArgs("Alphabet", monitorInfo);
                _scannerShown = true;
                showPanel(this, arg);
            }

            handled = true;
        }
Exemplo n.º 13
0
        public bool OnQueryPanelChange(PanelRequestEventArgs arg)
        {
            Log.Debug("Query change for " + arg.PanelClass);
            if (arg.MonitorInfo.FgHwnd == _startupArg.HWnd)// && panelClass == PanelClasses.WindowsExplorerContextMenu)
            {
                if (PanelConfigMap.AreEqual(arg.PanelClass, PanelClasses.MenuDockContextMenu))
                {
                    return(true);
                }
                Log.Debug("Refuse Query change for " + arg.PanelClass);
                return(false);
            }

            return(true);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Raises an event to indicate that there was a request to
        /// display a scanner. The arg parameter contains info about
        /// which scanner to display
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="arg">panel request info</param>
        private void triggerPanelRequest(object sender, PanelRequestEventArgs arg)
        {
            Log.Debug("PanelClass: " + arg.PanelClass);
            if (_panelChangeNotifications.OnHold())
            {
                Log.Debug("Panel change request paused.  will not change panel");
                return;
            }

            if (EvtPanelRequest != null)
            {
                EvtPanelRequest(sender, arg);
            }
            else
            {
                Log.Debug("EvtPanelrequest is null");
            }
        }
Exemplo n.º 15
0
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug("OnFocus: " + monitorInfo.ToString());

            base.OnFocusChanged(monitorInfo, ref handled);

            setTextInterface(textInterface);

            if (!_menuShown)
            {
                var arg = new PanelRequestEventArgs(PanelClasses.None, monitorInfo);
                handled = getPanel(arg);

                if (handled)
                {
                    _menuShown = true;
                    showPanel(this, arg);
                }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Invoked when the focus changes either in the active window or when the
        /// active window itself changes.
        /// </summary>
        /// <param name="monitorInfo">Info about focused element</param>
        /// <param name="handled">was this handled</param>
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug("OnFocus: " + monitorInfo);

            base.OnFocusChanged(monitorInfo, ref handled);

            if (!_alphabetScannerShown && _fileBrowserScanner != null)
            {
                var arg = new PanelRequestEventArgs(PanelClasses.AlphabetMinimal, monitorInfo)
                {
                    TargetPanel = _fileBrowserScanner,
                    RequestArg  = _fileBrowserScanner,
                    UseCurrentScreenAsParent = true
                };
                showPanel(this, arg);
                _alphabetScannerShown = true;
            }

            handled = true;
        }
Exemplo n.º 17
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;
            Log.Debug(command);
            switch (command)
            {
            case "EmailOpenOrInbox":
                handleCmdEmailOpenOrInbox();
                break;

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

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

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

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

            case "EmailNextSimple":
                handleCmdEmailNextSimple();
                break;

            case "EmailPreviousSimple":
                handleCmdEmailPreviousSimple();
                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.LMenu, Keys.M, Keys.F);
                break;

            case "EmailBrowseDelete":
                if (DialogUtils.ConfirmScanner("Confirm Delete?"))
                {
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D);
                }

                break;

            case "EmailInboxDelete":
                if (DialogUtils.ConfirmScanner("Confirm Delete?"))
                {
                    AgentManager.Instance.Keyboard.Send(Keys.Delete);
                }

                break;

            case "EmailEnterText":
            {
                var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                showPanel(this, new PanelRequestEventArgs("Alphabet", monitorInfo));
                break;
            }

            case "EmailNextField":
                handleCmdEmailNextField();
                break;

            case "EmailPreviousField":
                handleCmdEmailPreviousField();
                break;

            case "EmailAttachFile":
                attachFile();
                break;

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

            case "EmailSend":
                if (DialogUtils.ConfirmScanner("Confirm Send?"))
                {
                    AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.E);
                }

                break;

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

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

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

            case "EmailInbox":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D1);
                break;

            case "EmailOutbox":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.D0);
                break;

            case "EmailJunkbox":
                AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.X);
                AgentManager.Instance.Keyboard.Send(Keys.J);
                break;

            case "EmailTrashbox":
                AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.X);
                AgentManager.Instance.Keyboard.Send(Keys.T);
                break;

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

            case "MailBoxes":
            {
                var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                var arg         = new PanelRequestEventArgs("EudoraMailBoxesContextMenu", "Eudora", monitorInfo)
                {
                    UseCurrentScreenAsParent = true
                };
                showPanel(this, arg);
            }

            break;

            case "EmailAction":
            {
                var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                var arg         = new PanelRequestEventArgs("EudoraMailActionContextMenu", "Eudora", monitorInfo)
                {
                    UseCurrentScreenAsParent = true
                };
                showPanel(this, arg);
            }

            break;

            case "EmailAddToContacts":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.K);
                break;

            default:
                base.OnRunCommand(command, commandArg, ref handled);
                break;
            }
        }
Exemplo n.º 18
0
        public virtual void OnRunCommand(String command, object arg, ref bool handled)
        {
            handled = true;
            switch (command)
            {
            case "OpenFile":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.O);
                break;

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

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

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

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

            case "DesktopSearch":
                AgentManager.Instance.Keyboard.Send(Keys.LWin, Keys.F);
                break;

            case "WindowsStartMenu":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.Escape);
                break;

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

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

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

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

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

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

            case "CmdMouseScanner":
            {
                var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                var panelArg    = new PanelRequestEventArgs(PanelClasses.Mouse, monitorInfo)
                {
                    UseCurrentScreenAsParent = true
                };
                showPanel(this, panelArg);
            }

            break;

            case "CmdCursorScanner":
            {
                var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                var panelArg    = new PanelRequestEventArgs(PanelClasses.Cursor, monitorInfo)
                {
                    UseCurrentScreenAsParent = true
                };
                showPanel(this, panelArg);
            }

            break;

            default:
                handled = false;
                break;
            }
        }
Exemplo n.º 19
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;
            }
        }
Exemplo n.º 20
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;
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Invoked when the user selects something in the scanner that
        /// corresponds to a mapped functionality.  For now we only
        /// support photo viewer. Extend this to support other
        /// functionalities
        /// </summary>
        /// <param name="command">the command</param>
        /// <param name="commandArg">any optional arguments</param>
        /// <param name="handled">was it handled?</param>
        public override void OnRunCommand(String command, object commandArg, ref bool handled)
        {
            handled = true;

            switch (command)
            {
            case "NextPhoto":
                Context.AppAgentMgr.Keyboard.Send(Keys.Right);
                break;

            case "PreviousPhoto":
                Context.AppAgentMgr.Keyboard.Send(Keys.Left);
                break;

            case "PhotoDelete":
                Context.AppAgentMgr.Keyboard.Send(Keys.Delete);
                break;

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

            break;

            case "PhotoViewerRotateMenu":
            {
                var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                var panelArg    = new PanelRequestEventArgs("PhotoViewerRotateMenu", PhotoViewerTitle, monitorInfo)
                {
                    UseCurrentScreenAsParent = true
                };

                showPanel(this, panelArg);
            }

            break;

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

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

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

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

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

            default:
                base.OnRunCommand(command, commandArg, ref handled);
                break;
            }
        }
Exemplo n.º 22
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;
            }
        }
Exemplo n.º 23
0
 /// <summary>
 /// Event handler for request to display a scanner
 /// </summary>
 /// <param name="sender">event sender</param>
 /// <param name="arg">event arg</param>
 private void agent_EvtPanelRequest(object sender, PanelRequestEventArgs arg)
 {
     Log.Debug("Panel request for " + arg.PanelClass);
     triggerPanelRequest(sender, arg);
 }
Exemplo n.º 24
0
 void showWindowsExplorerScanner(String panel)
 {
     WindowActivityMonitorInfo monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
     PanelRequestEventArgs panelArg = new PanelRequestEventArgs(panel, monitorInfo);
     panelArg.Title = "Explorer";
     panelArg.UseCurrentScreenAsParent = true;
     showPanel(this, panelArg);
 }
Exemplo n.º 25
0
 /// <summary>
 /// Depending on the context, returns the appropriate scanner
 /// to activate
 /// </summary>
 /// <param name="arg">contextual info</param>
 /// <returns>true on success</returns>
 private bool getLectureManagerPanel(PanelRequestEventArgs arg)
 {
     arg.PanelClass = "LectureManagerContextMenuSimple";
     arg.Title      = "Lecture Mgr";
     return(true);
 }
Exemplo n.º 26
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 "SwitchAppWindow":
                DialogUtils.ShowTaskSwitcher(ChromeProcessName);
                break;

            case "ChromeAddressBar":
                AgentManager.Instance.Keyboard.Send(Keys.LControlKey, Keys.L);
                break;

            case "ChromeZoomMenu":
            {
                var monitorInfo = WindowActivityMonitor.GetForegroundWindowInfo();
                var panelArg    = new PanelRequestEventArgs("ChromeBrowserZoomMenu", "Chrome", monitorInfo)
                {
                    UseCurrentScreenAsParent = true
                };
                showPanel(this, panelArg);
            }

            break;

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

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

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

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

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

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

            case "ChromeGoForward":
                AgentManager.Instance.Keyboard.Send(Keys.LMenu, Keys.Right);
                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;

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

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

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

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

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

            case "ChromeBrowserMenu":
                showPanel(this, new PanelRequestEventArgs("ChromeBrowserMenu",
                                                          "Chrome",
                                                          WindowActivityMonitor.GetForegroundWindowInfo(),
                                                          true));
                break;


            default:
                base.OnRunCommand(command, commandArg, ref handled);
                break;
            }
        }
Exemplo n.º 27
0
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug("OnFocus: " + monitorInfo.ToString());

            base.OnFocusChanged(monitorInfo, ref handled);

            setTextInterface(textInterface);

            if (!_menuShown)
            {
                var arg = new PanelRequestEventArgs(PanelClasses.None, monitorInfo);
                handled = getPanel(arg);

                if (handled)
                {
                    _menuShown = true;
                    showPanel(this, arg);
                }
            }
        }
Exemplo n.º 28
0
 private bool getPanel(PanelRequestEventArgs arg)
 {
     arg.PanelClass = "LectureManagerContextMenuSimple";
     arg.Title = "Lecture Mgr";
     return true;
 }
Exemplo n.º 29
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;
            }
        }
Exemplo n.º 30
0
 /// <summary>
 /// Not used
 /// </summary>
 /// <param name="eventArg"></param>
 /// <returns></returns>
 public bool OnQueryPanelChange(PanelRequestEventArgs eventArg)
 {
     return(true);
 }
Exemplo n.º 31
0
        public override void OnContextMenuRequest(WindowActivityMonitorInfo monitorInfo)
        {
            PanelRequestEventArgs arg = new PanelRequestEventArgs(PanelClasses.None, monitorInfo);

            getPanel(arg);

            showPanel(this, arg);
        }