C# Class ACAT.Lib.Extension.AppAgents.Outlook.OutlookAgentBase

Base class for the Outlook email application. Tracks the currently focused window/field in Outlook and displays the appropriate contextual menu to enable the user to interact with Outlook. Has the ability to support multiple versions of Outlook, currently only supports Outlook 2010.
Inheritance: ACAT.Lib.Core.AgentManagement.GenericAppAgentBase
Show file Open project: brlima94/acat-localization

Public Properties

Property Type Description
outlookControlSubType OutlookControlSubType
outlookWindowType OutlookWindowTypes

Protected Properties

Property Type Description
autoSwitchScanners bool
controlType System.Windows.Automation.ControlType
outlookInspector IOutlookInspector

Public Methods

Method Description
CheckWidgetEnabled ( ACAT.Lib.Core.AgentManagement.CheckEnabledArgs arg ) : void

Invoked to set the 'enabled' state of a widget. This will depend on the current context.

OnContextMenuRequest ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : void

Displays the contextual menu

OnFocusChanged ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, bool &handled ) : void

Invoked when the foreground window focus changes. Display the scanner depending on the context.

OnFocusLost ( ) : void

Focus shifted to another app. This agent is getting deactivated.

OnRunCommand ( String command, object commandArg, bool &handled ) : void

Invoked to run a command from all the Outlook contextual menus

OutlookAgentBase ( ) : System

Initializes an instance of hte class

Protected Methods

Method Description
IsOutlookInstalled ( ) : bool
actuateStandardControl ( ControlType ctrlType ) : bool

Actuates a standard windows control such as a button, checkbox etc.

attachFile ( ) : void

Attaches a file to the current email being composed. Launches the file browser to get the file to attach from the user. Sends a command to bring up the Outlook "Insert File" dialog. Inserts the filename into the file name field in the dialog

createEditControlTextInterface ( IntPtr handle, AutomationElement focusedElement, bool &handled ) : ACAT.Lib.Core.AgentManagement.TextInterface.TextControlAgentBase

Creates an edit control text agent to manipulate text in the target text control that's currently active. the 'handled' param is set to true if it was handled successfully.

createKeyLoggerTextInterface ( IntPtr handle, AutomationElement editTextElement ) : ACAT.Lib.Core.AgentManagement.TextInterface.TextControlAgentBase

Creates a keylogger interface for all those edit controls that don't support the TextPattern. Depending on the type of the field we enable/disable abbreviations, smart punctuations, learning and spell check

getContextualMenuForWindow ( OutlookWindowTypes windowType, String &title ) : String

Returns the name of the contextual menu for the window/element currently in focus.

getOutlookVersion ( ) : int

Returns the outlook version install on the client machine. 14.0 is Outlook 2010

gotoNextField ( ) : void

Tabs to the next field in the window

gotoPreviousField ( ) : void

Tabs to the previous field in the window

identifyWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : OutlookWindowTypes

Identify the top level window in Outlook

isAppointmentSchedulingWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : bool

Is the active window the Appointement scheduling window?

isCalendarWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : bool

Is the active window the Outlook calendar window?

isContactsWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : bool

Is the active window the "Contacts" window?

isEmailMsgWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, bool &isNewMessage, OutlookControlSubType &subType ) : bool

Is the active window a new or existing open email window?

isInboxWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : bool

Is the active window the email inbox window?

isNotesWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : bool

Is the active window the "Contacts" window?

isOpenAppointmentWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : bool

Is the active window an open Appointment window?

isOpenContactWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : bool

Is the active window an open "Contact" window?

isOpenNoteWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : bool

Is the active window an open Outlook "Note" window?

isOpenTaskWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : bool
isTasksWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : bool

Is the active window an open Task window?

Private Methods

Method Description
createOutlookInspector ( ) : IOutlookInspector

Creates the outlook inspector depending on the version of Outlook installed on the client computer. Returns default inspector if outlook is not installed or is the unsupported version.

getFileToAttach ( ) : System.Threading.Tasks.Task

Activates the file browser agent to get the name of the file to attach

isMessageBodyField ( OutlookControlSubType subType ) : bool

Checks if the specified window element is a message body field

isSubjectField ( OutlookControlSubType subType ) : bool

Checks if the specified window element is a 'Subject' field

isTopLevelWindow ( OutlookWindowTypes windowType ) : bool

Checks if the specified window is a top-level window in Outlook

Method Details

CheckWidgetEnabled() public method

Invoked to set the 'enabled' state of a widget. This will depend on the current context.
public CheckWidgetEnabled ( ACAT.Lib.Core.AgentManagement.CheckEnabledArgs arg ) : void
arg ACAT.Lib.Core.AgentManagement.CheckEnabledArgs contains info about the widget
return void

IsOutlookInstalled() protected method

protected IsOutlookInstalled ( ) : bool
return bool

OnContextMenuRequest() public method

Displays the contextual menu
public OnContextMenuRequest ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : void
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Foreground window info
return void

OnFocusChanged() public method

Invoked when the foreground window focus changes. Display the scanner depending on the context.
public OnFocusChanged ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, bool &handled ) : void
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Foreground window info
handled bool set to true if handled
return void

OnFocusLost() public method

Focus shifted to another app. This agent is getting deactivated.
public OnFocusLost ( ) : void
return void

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

OutlookAgentBase() public method

Initializes an instance of hte class
public OutlookAgentBase ( ) : System
return System

actuateStandardControl() protected method

Actuates a standard windows control such as a button, checkbox etc.
protected actuateStandardControl ( ControlType ctrlType ) : bool
ctrlType System.Windows.Automation.ControlType Type of the control
return bool

attachFile() protected method

Attaches a file to the current email being composed. Launches the file browser to get the file to attach from the user. Sends a command to bring up the Outlook "Insert File" dialog. Inserts the filename into the file name field in the dialog
protected attachFile ( ) : void
return void

createEditControlTextInterface() protected method

Creates an edit control text agent to manipulate text in the target text control that's currently active. the 'handled' param is set to true if it was handled successfully.
protected createEditControlTextInterface ( IntPtr handle, AutomationElement focusedElement, bool &handled ) : ACAT.Lib.Core.AgentManagement.TextInterface.TextControlAgentBase
handle System.IntPtr handle to the active window
focusedElement System.Windows.Automation.AutomationElement the active text control
handled bool true if handled
return ACAT.Lib.Core.AgentManagement.TextInterface.TextControlAgentBase

createKeyLoggerTextInterface() protected method

Creates a keylogger interface for all those edit controls that don't support the TextPattern. Depending on the type of the field we enable/disable abbreviations, smart punctuations, learning and spell check
protected createKeyLoggerTextInterface ( IntPtr handle, AutomationElement editTextElement ) : ACAT.Lib.Core.AgentManagement.TextInterface.TextControlAgentBase
handle System.IntPtr handle of the window
editTextElement System.Windows.Automation.AutomationElement edit control automation element
return ACAT.Lib.Core.AgentManagement.TextInterface.TextControlAgentBase

getContextualMenuForWindow() protected method

Returns the name of the contextual menu for the window/element currently in focus.
protected getContextualMenuForWindow ( OutlookWindowTypes windowType, String &title ) : String
windowType OutlookWindowTypes Type of window
title String returns the title
return String

getOutlookVersion() protected method

Returns the outlook version install on the client machine. 14.0 is Outlook 2010
protected getOutlookVersion ( ) : int
return int

gotoNextField() protected method

Tabs to the next field in the window
protected gotoNextField ( ) : void
return void

gotoPreviousField() protected method

Tabs to the previous field in the window
protected gotoPreviousField ( ) : void
return void

identifyWindow() protected method

Identify the top level window in Outlook
protected identifyWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : OutlookWindowTypes
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
subType OutlookControlSubType The focused Outlook window control element
return OutlookWindowTypes

isAppointmentSchedulingWindow() protected method

Is the active window the Appointement scheduling window?
protected isAppointmentSchedulingWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
subType OutlookControlSubType The focused Outlook window control element
return bool

isCalendarWindow() protected method

Is the active window the Outlook calendar window?
protected isCalendarWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
return bool

isContactsWindow() protected method

Is the active window the "Contacts" window?
protected isContactsWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
return bool

isEmailMsgWindow() protected method

Is the active window a new or existing open email window?
protected isEmailMsgWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, bool &isNewMessage, OutlookControlSubType &subType ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
isNewMessage bool true if this is a new email window
subType OutlookControlSubType The focused Outlook window control element
return bool

isInboxWindow() protected method

Is the active window the email inbox window?
protected isInboxWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
return bool

isNotesWindow() protected method

Is the active window the "Contacts" window?
protected isNotesWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
return bool

isOpenAppointmentWindow() protected method

Is the active window an open Appointment window?
protected isOpenAppointmentWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
subType OutlookControlSubType The focused Outlook window control element
return bool

isOpenContactWindow() protected method

Is the active window an open "Contact" window?
protected isOpenContactWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
subType OutlookControlSubType The focused Outlook window control element
return bool

isOpenNoteWindow() protected method

Is the active window an open Outlook "Note" window?
protected isOpenNoteWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
subType OutlookControlSubType The focused Outlook window control element
return bool

isOpenTaskWindow() protected method

protected isOpenTaskWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo, OutlookControlSubType &subType ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo
subType OutlookControlSubType
return bool

isTasksWindow() protected method

Is the active window an open Task window?
protected isTasksWindow ( ACAT.Lib.Core.Utility.WindowActivityMonitorInfo monitorInfo ) : bool
monitorInfo ACAT.Lib.Core.Utility.WindowActivityMonitorInfo Active window info
return bool

Property Details

autoSwitchScanners protected property

protected bool autoSwitchScanners
return bool

controlType protected property

The ControlType of the element that currently has focus
protected ControlType,System.Windows.Automation controlType
return System.Windows.Automation.ControlType

outlookControlSubType public property

The window element (eg button, edit box) that has focus
public OutlookControlSubType outlookControlSubType
return OutlookControlSubType

outlookInspector protected property

Inspector object that interfaces with the version of Outlook installed on the machine
protected IOutlookInspector outlookInspector
return IOutlookInspector

outlookWindowType public property

The window type that has focus - eg, inbox, tasks, contacts, open email etc
public OutlookWindowTypes outlookWindowType
return OutlookWindowTypes