Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 /// <param name="monitorInfo">Active window info</param>
 /// <param name="widget">Scanner button that needs to be enabled/disabled</param>
 public CheckEnabledArgs(WindowActivityMonitorInfo monitorInfo, Widget widget)
 {
     Handled = false;
     Enabled = false;
     Widget = widget;
     MonitorInfo = monitorInfo;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="panelClass">The scanner to be activted</param>
        /// <param name="monitorInfo">Contextual info about app window</param>
        public PanelRequestEventArgs(String panelClass, WindowActivityMonitorInfo monitorInfo)
        {
            init();

            PanelClass = panelClass;
            MonitorInfo = monitorInfo;
        }
Ejemplo n.º 3
0
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug();

            setTextInterface(_textInterface);

            handled = true;
        }
Ejemplo n.º 4
0
 public override void OnContextMenuRequest(WindowActivityMonitorInfo monitorInfo)
 {
     #if AUTO_SWITCH_SCANNER
     String panelClass = PanelClasses.None;
     if (!getPanel(monitorInfo, true, ref panelClass))
     {
         if (isDesktopWindow(monitorInfo.FocusedElement))
         {
             showPanel(this, new PanelRequestEventArgs("WindowsDesktopContextMenu", "Desktop", monitorInfo));
             return;
         }
     }
     showPanel(this, new PanelRequestEventArgs(panelClass, "Explorer", monitorInfo));
     #endif
 }
Ejemplo n.º 5
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);
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Invoked when the foreground window focus changes.  Display the
        /// contextual menus for dialogs which will allow interaction with the dialog
        /// </summary>
        /// <param name="monitorInfo">Foreground window info</param>
        /// <param name="handled">set to true if handled</param>
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug();

            Log.Debug("prevHwnd: " + _prevHwnd + ", fgHwnd: " + monitorInfo.FgHwnd);

            if (autoSwitchScanners && _prevHwnd != monitorInfo.FgHwnd)
            {
                Log.Debug("They are not equal. Show dialog panel");

                base.OnFocusChanged(monitorInfo, ref handled);

                showPanel(this, new PanelRequestEventArgs(PanelClasses.DialogContextMenu,
                                                            monitorInfo.Title,
                                                            monitorInfo));

                _prevHwnd = monitorInfo.FgHwnd;
            }

            handled = true;
        }
Ejemplo n.º 7
0
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug("OnFocus: " + monitorInfo.ToString());

            base.OnFocusChanged(monitorInfo, ref handled);

            if (monitorInfo.IsNewWindow)
            {
                showPanelOnFocusChanged(this, new PanelRequestEventArgs(PanelClasses.Alphabet, monitorInfo));
                handled = true;
            }

            #if abc
            String panel = PanelClasses.None;
            handled = getPanel(monitorInfo, false, ref panel);

            if (handled)
            {
                showPanelOnFocusChanged(this, new PanelRequestEventArgs(panel, "Explorer", monitorInfo));
            }
            #endif
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Invoked when the foreground window focus changes. Displays the
        /// scanner depending on the context. Also, if this is a new window that has
        /// come into focus, adds its contents to the word prediction temporary batch model for more
        /// contextual prediction of words
        /// </summary>
        /// <param name="monitorInfo">Foreground window info</param>
        /// <param name="handled">set to true if handled</param>
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug();

            if (String.Compare(monitorInfo.FocusedElement.Current.ClassName, DocClassName, true) == 0)
            {
                createMSWordTextInterface();
                if (monitorInfo.IsNewFocusedElement)
                {
                    showPanel(this, new PanelRequestEventArgs(PanelClasses.Alphabet, monitorInfo));
                }

                if (monitorInfo.IsNewWindow)
                {
                    loadWordPredictionContext();
                }
            }
            else if (autoSwitchScanners)
            {
                if (isRecentDocuments(monitorInfo.FocusedElement))
                {
                    showPanel(this, new PanelRequestEventArgs(PanelClasses.DialogContextMenu, ScannerTitle, monitorInfo));
                }
                else if (String.Compare(monitorInfo.FocusedElement.Current.ClassName, "NetUIToolWindow") == 0)
                {
                    showPanel(this, new PanelRequestEventArgs(PanelClasses.MenuContextMenu, ScannerTitle, monitorInfo));
                }
                else
                {
                    handled = false;
                    return;
                }
            }
            else if (!_scannerShown)
            {
                showPanel(this, new PanelRequestEventArgs(PanelClasses.Alphabet, monitorInfo));
                _scannerShown = true;
            }

            handled = true;
        }
        /// <summary>
        /// Displays the scanner appropriate for the element that is currently
        /// in focus in the Windows explorer window
        /// </summary>
        /// <param name="monitorInfo">Foreground window info</param>
        /// <param name="handled">set to true if handled</param>
        private void displayScanner(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug("KILLROY Entered");
            if (monitorInfo.FocusedElement.Current.ControlType.ProgrammaticName == "ControlType.Edit")
            {
                Log.Debug("KILLROY controtype edit");

                base.OnFocusChanged(monitorInfo, ref handled);
                showPanel(this, new PanelRequestEventArgs(PanelClasses.Alphabet, monitorInfo));
                _scannerShown = true;
            }
            else// if (monitorInfo.IsNewWindow)
            {
                Log.Debug("KILLROY calling getmenu");

                String panel = PanelClasses.None;
                handled = getMenu(monitorInfo, ref panel);

                if (handled)
                {
                    showPanel(this, new PanelRequestEventArgs(panel, "Explorer", monitorInfo));
                    _scannerShown = true;
                }
            }
#if abc
            else
            {
                Log.Debug("KILLROY *** FALL THROUGH>  WILL NOT BE HANDLED");

                //handled = true;
            }
#endif
        }
        /// <summary>
        /// Invoked when the foreground window focus changes. Depending on which
        /// element has focus in the acrobat reader window, display the appropriate
        /// scanner
        /// </summary>
        /// <param name="monitorInfo">Foreground window info</param>
        /// <param name="handled">set to true if handled</param>
        public override void OnFocusChanged(WindowActivityMonitorInfo monitorInfo, ref bool handled)
        {
            Log.Debug();

            if (monitorInfo.IsNewWindow)
            {
                _scannerShown = false;
            }

            if (autoSwitchScanners)
            {
                if (!_scannerShown)
                {
                    displayScanner(monitorInfo, ref handled);
                }
                else
                {
                    handled = true;
                }
            }
            else
            {
                base.OnFocusChanged(monitorInfo, ref handled);
                if (!_scannerShown)
                {
                    showPanel(this, new PanelRequestEventArgs(PanelClasses.Alphabet, monitorInfo));
                    _scannerShown = true;
                }

                handled = true;
            }
        }
Ejemplo n.º 11
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;
            }
        }
Ejemplo 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>
 public void OnFocusChanged(WindowActivityMonitorInfo monitorInfo)
 {
     _alphabetScannerCommon.OnFocusChanged(monitorInfo);
 }
Ejemplo n.º 13
0
 public override void OnContextMenuRequest(WindowActivityMonitorInfo monitorInfo)
 {
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Is the active window the "Contacts" window?
 /// </summary>
 /// <param name="monitorInfo">Active window info</param>
 /// <returns>true if it is</returns>
 public bool IsNotesWindow(WindowActivityMonitorInfo monitorInfo)
 {
     return (monitorInfo.Title.StartsWith("Notes - ") && monitorInfo.Title.EndsWith("Microsoft Outlook"));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Initialzies an instance of the class
 /// </summary>
 /// <param name="monitorInfo">Focused element info</param>
 public FocusChangedEventArgs(WindowActivityMonitorInfo monitorInfo)
 {
     WindowActivityInfo = monitorInfo;
 }
Ejemplo n.º 16
0
        private static void getActiveWindow(bool flag = false)
        {
            AutomationElement focusedElement = null;

            try
            {
                IntPtr foregroundWindow = Windows.GetForegroundWindow();
                var    title            = Windows.GetWindowTitle(foregroundWindow);

                Log.Debug("fgHwnd = " + ((foregroundWindow != IntPtr.Zero) ? foregroundWindow.ToString() : "null") + ", title: " + title);

                if (Windows.GetOSVersion() == Windows.WindowsVersion.Win10 &&
                    title.StartsWith("Jump List for"))
                {
                    return;
                }

                focusedElement = AutomationElement.FocusedElement;

                Log.Debug("focusedElement is " + ((focusedElement != null) ? "not null" : "null"));
                Log.Debug("_currentfocusedElement is " + ((_currentFocusedElement != null) ? "not null" : "null"));

                bool elementChanged = true;

                var process = GetProcessForWindow(foregroundWindow);

                // check if anything changed. did the window focus change?
                // did focus change within the window?
                if (focusedElement != null &&
                    (_forceGetActiveWindow || flag || foregroundWindow != _currentHwnd || _currentFocusedElement == null ||
                     (elementChanged = IsDifferent(focusedElement, _currentFocusedElement))))
                {
                    //Log.Debug("Reason: _forceGetActiveWindow: " + _forceGetActiveWindow);
                    //Log.Debug("Reason: flag: " + flag);
                    //Log.Debug("Reason: fgHwnd != _currentHwnd : " + (fgHwnd != _currentHwnd));
                    //Log.Debug("Reason: _currentFocusedElement == null : " + (_currentFocusedElement == null));
                    //Log.Debug("Reason: elementChanged : " + elementChanged);

                    if (_forceGetActiveWindow)
                    {
                        _forceGetActiveWindow = false;
                    }

                    if (EvtFocusChanged != null)
                    {
                        var monitorInfo = new WindowActivityMonitorInfo
                        {
                            FgHwnd         = foregroundWindow,
                            Title          = title,
                            FgProcess      = process,
                            FocusedElement = focusedElement,
                            IsNewWindow    = _currentHwnd != foregroundWindow
                        };

                        if (flag)
                        {
                            monitorInfo.IsNewWindow = true;
                        }

                        if (monitorInfo.IsNewWindow || _currentFocusedElement == null || elementChanged)
                        {
                            monitorInfo.IsNewFocusedElement = true;
                        }

#if VERBOSE
                        Log.Debug("#$#>>>>>>>>>>>>>>>> Triggering FOCUS changed event");

                        Log.Debug("#$#    title: " + title);
                        Log.Debug("#$#    fgHwnd " + monitorInfo.FgHwnd);
                        Log.Debug("#$#    nativewinhandle: " + focusedElement.Current.NativeWindowHandle);
                        Log.Debug("#$#    Process: " + process.ProcessName);
                        Log.Debug("#$#    class: " + focusedElement.Current.ClassName);
                        Log.Debug("#$#    controltype:  " + focusedElement.Current.ControlType.ProgrammaticName);
                        Log.Debug("#$#    automationid: " + focusedElement.Current.AutomationId);
                        Log.Debug("#$#    newWindow: " + monitorInfo.IsNewWindow);
                        Log.Debug("#$#    newFocusElement: " + monitorInfo.IsNewFocusedElement);
                        Log.Debug("#$#    IsMinimized :  " + Windows.IsMinimized(monitorInfo.FgHwnd));
#endif

                        if (monitorInfo.IsNewWindow)
                        {
                            AuditLog.Audit(new AuditEventActiveWindowChange(process.ProcessName, title));
                        }

                        if (EvtFocusChanged != null)
                        {
                            EvtFocusChanged(monitorInfo);
                        }

                        _currentFocusedElement = focusedElement;
                    }
                    else
                    {
                        Log.Debug("EvtFocusChanged is null");
                    }
                }

                _currentHwnd = foregroundWindow;

                // raise the heartbeat event
                if (EvtWindowMonitorHeartbeat != null && focusedElement != null && _heartbeatToggle)
                {
                    var monitorInfo = new WindowActivityMonitorInfo
                    {
                        FgHwnd         = foregroundWindow,
                        FocusedElement = focusedElement,
                        Title          = title,
                        FgProcess      = process
                    };
                    EvtWindowMonitorHeartbeat(monitorInfo);
                }

                _heartbeatToggle = !_heartbeatToggle;
            }
            catch (Exception e)
            {
                Log.Debug("exception: " + e);
                _currentFocusedElement = null;
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Invoked when the focus changes either in the active window or when the
 /// active window itself changes. Call this from the OnFocusChanged function
 /// in the Alphabet scanner
 /// </summary>
 /// <param name="inf">Info about focused element</param>
 public void OnFocusChanged(WindowActivityMonitorInfo info)
 {
     _scannerCommon.OnFocusChanged(info);
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Is the active window an open "Contact" window?
        /// </summary>
        /// <param name="monitorInfo">Active window info</param>
        /// <param name="subType">The focused Outlook window control element </param>
        /// <returns>true if it is</returns>
        public bool IsOpenContactWindow(WindowActivityMonitorInfo monitorInfo, ref OutlookControlSubType subType)
        {
            Log.Debug();

            subType = OutlookControlSubType.Unknown;

            bool retVal = true;

            if (monitorInfo.FocusedElement == null)
            {
                return false;
            }

            var windowElement = AutomationElement.FromHandle(monitorInfo.FgHwnd);
            var element = (AgentUtils.FindElementByAutomationId(windowElement, "RichEdit20WPT", ControlType.Edit, "4481", "Company:") ??
                           AgentUtils.FindElementByAutomationId(windowElement, "RichEdit20WPT", ControlType.Edit, "4480", "Job Title:")) ??
                          AgentUtils.FindElementByAutomationId(windowElement, "RichEdit20WPT", ControlType.Edit, "4096", "FullName");

            retVal = (element != null);

            if (retVal)
            {
                if (AgentUtils.IsElementByAutomationId(monitorInfo.FocusedElement, "_WwG", "ControlType.Pane", "", "Message"))
                {
                    subType = OutlookControlSubType.ContactMessageField;
                }
            }

            Log.Debug("Returning " + retVal);
            return retVal;
        }
Ejemplo n.º 19
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() + ", menushown: " + _scannerShown);

            base.OnFocusChanged(monitorInfo, ref handled);

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

            handled = true;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Is the active window an open Outlook "Note" window?
        /// </summary>
        /// <param name="monitorInfo">Active window info</param>
        /// <param name="subType">The focused Outlook window control element </param>
        /// <returns>true if it is</returns>
        public bool IsOpenNoteWindow(WindowActivityMonitorInfo monitorInfo, ref OutlookControlSubType subType)
        {
            bool retVal = false;

            subType = OutlookControlSubType.Unknown;

            var element = AgentUtils.GetElementOrAncestorByAutomationId(monitorInfo.FocusedElement, "RichEdit20WPT", "ControlType.Edit", "4159");
            if (element != null)
            {
                var name = element.Current.Name;
                retVal = (name == "Note text");
            }

            if (retVal)
            {
                if (AgentUtils.IsElementByAutomationId(monitorInfo.FocusedElement, "RichEdit20WPT", "ControlType.Edit", "4159"))
                {
                    subType = OutlookControlSubType.OpenNoteMessageBodyField;
                }
            }

            return retVal;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Displays the contextual menu
        /// </summary>
        /// <param name="monitorInfo">Foreground window info</param>
        public override void OnContextMenuRequest(WindowActivityMonitorInfo monitorInfo)
        {
            //if (autoSwitchScanners)
            //{
            //    AgentManager.Instance.Keyboard.Send(Keys.F6);
            //}

            showPanel(this, new PanelRequestEventArgs("InternetExplorerContextMenu", ScannerTitle, monitorInfo));
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Is the active window an open "Task" window?
        /// </summary>
        /// <param name="monitorInfo">Active window info</param>
        /// <param name="subType">The focused Outlook window control element </param>
        /// <returns>true if it is</returns>
        public bool IsOpenTaskWindow(WindowActivityMonitorInfo monitorInfo, ref OutlookControlSubType subType)
        {
            Log.Debug();

            subType = OutlookControlSubType.Unknown;

            bool retVal = true;

            if (monitorInfo.FocusedElement == null)
            {
                return false;
            }

            var windowElement = AutomationElement.FromHandle(monitorInfo.FgHwnd);

            if (windowElement == null)
            {
                return false;
            }

            var element = (AgentUtils.FindElementByAutomationId(windowElement, "REComboBox20W", ControlType.ComboBox, "4481", "Status:") ??
                           AgentUtils.FindElementByAutomationId(windowElement, "REComboBox20W", ControlType.ComboBox, "4480", "Priority:")) ??
                          AgentUtils.FindElementByAutomationId(windowElement, "RichEdit20WPT", ControlType.Edit, "4112", "% Complete:");

            retVal = (element != null);

            if (retVal)
            {
                if (AgentUtils.IsElementByAutomationId(monitorInfo.FocusedElement, "RichEdit20WPT", "ControlType.Edit", "4097", "Subject:"))
                {
                    subType = OutlookControlSubType.TaskSubjectField;
                }
                else if (AgentUtils.IsElementByAutomationId(monitorInfo.FocusedElement, "_WwG", "ControlType.Pane", "", "Message"))
                {
                    subType = OutlookControlSubType.TaskMessageBodyField;
                }
            }

            Log.Debug("Returning " + retVal);
            return retVal;
        }
Ejemplo n.º 23
0
 public override void OnContextMenuRequest(WindowActivityMonitorInfo monitorInfo)
 {
     showPanel(this, new PanelRequestEventArgs(PanelClasses.UnsupportedAppContextMenu, monitorInfo));
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Is the active window the Task window?
 /// </summary>
 /// <param name="monitorInfo">Active window info</param>
 /// <param name="subType">The focused Outlook window control element </param>
 /// <returns>true if it is</returns>
 public bool IsTasksWindow(WindowActivityMonitorInfo monitorInfo)
 {
     return ((monitorInfo.Title.StartsWith("Tasks - ") || monitorInfo.Title.StartsWith("To-Do List")) && monitorInfo.Title.EndsWith("Microsoft Outlook"));
 }
 /// <summary>
 /// Displays the contextual menu
 /// </summary>
 /// <param name="monitorInfo">Foreground window info</param>
 public override void OnContextMenuRequest(WindowActivityMonitorInfo monitorInfo)
 {
     // Do a panel switch to the main document
     //AgentManager.Instance.Keyboard.Send(Keys.F6);
     showPanel(this, new PanelRequestEventArgs(ContextualMenuName, "Explorer", monitorInfo));
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Is the active window the "Contacts" window?
        /// </summary>
        /// <param name="monitorInfo">Active window info</param>
        /// <param name="subType">The focused Outlook window control element </param>
        /// <returns>true if it is</returns>
        public OutlookWindowTypes IdentifyWindow(WindowActivityMonitorInfo monitorInfo, ref OutlookControlSubType subType)
        {
            var windowType = OutlookWindowTypes.Unknown;

            bool isNewEmail = false;

            subType = OutlookControlSubType.Unknown;

            if (IsEmailMsgWindow(monitorInfo, ref isNewEmail, ref subType))
            {
                windowType = (isNewEmail) ? OutlookWindowTypes.NewEmailMessage : OutlookWindowTypes.EmailMessage;
            }
            else if (IsTasksWindow(monitorInfo))
            {
                windowType = OutlookWindowTypes.Tasks;
            }
            else if (IsNotesWindow(monitorInfo))
            {
                windowType = OutlookWindowTypes.Notes;
            }
            else if (IsContactsWindow(monitorInfo))
            {
                windowType = OutlookWindowTypes.Contacts;
            }
            else if (IsCalendarWindow(monitorInfo))
            {
                windowType = OutlookWindowTypes.Calendar;
            }
            else if (IsInboxWindow(monitorInfo))
            {
                windowType = OutlookWindowTypes.Inbox;
            }
            else if (IsOpenNoteWindow(monitorInfo, ref subType))
            {
                windowType = OutlookWindowTypes.OpenNote;
            }
            else if (IsOpenAppointmentWindow(monitorInfo, ref subType))
            {
                windowType = OutlookWindowTypes.OpenAppointment;
            }
            else if (IsAppointmentSchedulingWindow(monitorInfo, ref subType))
            {
                windowType = OutlookWindowTypes.AppointmentScheduling;
            }
            else if (IsOpenContactWindow(monitorInfo, ref subType))
            {
                windowType = OutlookWindowTypes.OpenContact;
            }
            else if (IsOpenTaskWindow(monitorInfo, ref subType))
            {
                windowType = OutlookWindowTypes.OpenTask;
            }
            else if (IsAddressBookWindow(monitorInfo, ref subType))
            {
                windowType = OutlookWindowTypes.AddressBook;
            }
            else if (IsAddressBookDetailsWindow(monitorInfo))
            {
                windowType = OutlookWindowTypes.AddressBookDetails;
            }

            return windowType;
        }
        /// <summary>
        /// Gets the menu for the Explorer window in focus.  Checks if the
        /// file explorer is active and returns the contextual menu name for it
        /// </summary>
        /// <param name="monitorInfo">fg window info</param>
        /// <param name="panelClass">returns the panel class of the menu</param>
        /// <returns>true if it found a menu for the window</returns>
        protected bool getMenu(WindowActivityMonitorInfo monitorInfo, ref String panelClass)
        {
            AutomationElement windowElement = getWindowElement(monitorInfo.FgHwnd);

            bool retVal = true;
            if (windowElement != null)
            {
                if (isFileExplorer(windowElement))
                {
                    Log.Debug("KILLROY isFileExploer is TRUE ");
                    if (Windows.IsMinimized(monitorInfo.FgHwnd))
                    {
                        retVal = false;
                    }
                    else
                    {
                        panelClass = ContextualMenuName;
                    }
                }
                else
                {
                    Log.Debug("KILLROY isFileExploer is FALSE");
                    retVal = false;
                }
            }
            else
            {
                Log.Debug("KILLROY windowElement is NULL");

            }

            Log.Debug("KILLROY return from getmenu : " + retVal);
            return retVal;
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Get all the widgets whose "enabled" property is set to
        /// contextual in the config file.  Decide the "enabled" state
        /// of these widgets depending on the context
        /// </summary>
        /// <param name="monitorInfo">Context info about active window</param>
        private void SetWidgetEnabledStates(WindowActivityMonitorInfo monitorInfo)
        {
            if (_syncLock.IsClosing())
            {
                Log.Debug("Form is closing " + ScannerForm.Name);
                WindowActivityMonitor.EvtWindowMonitorHeartbeat -= WindowActivityMonitor_EvtWindowMonitorHeartbeat;
                return;
            }

            if (_rootWidget != null && Context.AppAgentMgr != null && !_syncLock.IsClosing() && Windows.GetVisible(ScannerForm))
            {
                foreach (Widget widget in _rootWidget.WidgetLayout.ContextualWidgets)
                {
                    ////Log.Debug("Widget: " + widget.Name + ", subclass: " + widget.SubClass);

                    if (!String.IsNullOrEmpty(widget.SubClass))
                    {
                        var arg = new CheckEnabledArgs(monitorInfo, widget);
                        if (!_syncLock.IsClosing())
                        {
                            _scannerPanel.CheckWidgetEnabled(arg);

                            if (!arg.Handled)
                            {
                                Context.AppAgentMgr.CheckWidgetEnabled(arg);
                            }

                            widget.Enabled = arg.Handled ? arg.Enabled : widget.DefaultEnabled;
                        }
                        else
                        {
                            break;
                        }

                        ////Log.Debug("widget.Enabled set to : " + widget.Enabled + " for feature " + widget.SubClass);
                    }
                }
            }
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Displays the contextual menu
 /// </summary>
 /// <param name="monitorInfo">Foreground window info</param>
 public override void OnContextMenuRequest(WindowActivityMonitorInfo monitorInfo)
 {
     showPanel(this, new PanelRequestEventArgs("MSWordContextMenu", ScannerTitle, monitorInfo));
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Heartbeat handler from the windowactivitymonitor.  Use this
 /// monitor to set the 'enabled' state of the widgets in the scanner
 /// based on the context.
 /// </summary>
 /// <param name="monitorInfo">active window context info</param>
 private void WindowActivityMonitor_EvtWindowMonitorHeartbeat(WindowActivityMonitorInfo monitorInfo)
 {
     try
     {
         SetWidgetEnabledStates(monitorInfo);
     }
     catch
     {
     }
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Not used
 /// </summary>
 /// <param name="monitorInfo"></param>
 public void OnFocusChanged(WindowActivityMonitorInfo monitorInfo)
 {
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Focus changed in the foreground application. Set widget
 /// enabled states
 /// </summary>
 /// <param name="monitorInfo"></param>
 public void OnFocusChanged(WindowActivityMonitorInfo monitorInfo)
 {
     SetWidgetEnabledStates(monitorInfo);
 }