/// <summary> /// Invoked when the foreground window focus changes. Display the /// scanner depending on the context. /// </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(); outlookWindowType = identifyWindow(monitorInfo, ref outlookControlSubType); controlType = monitorInfo.FocusedElement.Current.ControlType; Log.Debug("OutlookWindowType: " + outlookWindowType + ", subType: " + outlookControlSubType); String title = PanelTitle; base.OnFocusChanged(monitorInfo, ref handled); if (autoSwitchScanners) { var panel = getContextualMenuForWindow(outlookWindowType, ref title); showPanel(this, new PanelRequestEventArgs(panel, title, monitorInfo)); } else { if (!_scannerShown) { showPanel(this, new PanelRequestEventArgs(PanelClasses.Alphabet, monitorInfo)); _scannerShown = true; } } handled = true; }
/// <summary> /// Returns the name of the contextual menu for the window/element /// currently in focus. /// </summary> /// <param name="windowType">Type of window</param> /// <param name="title">returns the title</param> /// <returns>name of the panel</returns> protected String getContextualMenuForWindow(OutlookWindowTypes windowType, ref String title) { Log.Debug("windowType: " + windowType); String scannerName; title = PanelTitle; switch (windowType) { case OutlookWindowTypes.EmailMessage: scannerName = "OutlookBrowseEmailContextMenu"; title = R.GetString("Mail"); break; case OutlookWindowTypes.NewEmailMessage: scannerName = "OutlookNewEmailContextMenu"; title = R.GetString("Mail"); break; case OutlookWindowTypes.Inbox: scannerName = "OutlookContextMenu"; title = R.GetString("Mail"); break; case OutlookWindowTypes.Calendar: scannerName = "OutlookContextMenu"; title = R.GetString("Calendar"); break; case OutlookWindowTypes.Tasks: scannerName = "OutlookContextMenu"; title = R.GetString("Tasks"); break; case OutlookWindowTypes.Contacts: scannerName = "OutlookContextMenu"; title = R.GetString("Contacts"); break; case OutlookWindowTypes.Notes: scannerName = "OutlookContextMenu"; title = R.GetString("Notes"); break; case OutlookWindowTypes.OpenNote: scannerName = PanelClasses.Alphabet; title = R.GetString("Note"); break; case OutlookWindowTypes.AppointmentScheduling: case OutlookWindowTypes.OpenAppointment: scannerName = "OutlookOpenAppointmentContextMenu"; title = R.GetString("Appointment"); break; case OutlookWindowTypes.OpenContact: scannerName = "OutlookOpenContactContextMenu"; title = R.GetString("Contact"); break; case OutlookWindowTypes.OpenTask: scannerName = "OutlookOpenTaskContextMenu"; title = R.GetString("Task"); break; case OutlookWindowTypes.AddressBookDetails: case OutlookWindowTypes.AddressBook: scannerName = "OutlookAddressBookContextMenu"; title = R.GetString("AddrBook"); break; default: scannerName = "OutlookContextMenu"; break; } return(scannerName); }
/// <summary> /// Checks if the specified window is a top-level window in Outlook /// </summary> /// <param name="windowType">window type</param> /// <returns>true if it is</returns> private bool isTopLevelWindow(OutlookWindowTypes windowType) { return(windowType == OutlookWindowTypes.Tasks || windowType == OutlookWindowTypes.Notes || windowType == OutlookWindowTypes.Inbox || windowType == OutlookWindowTypes.Contacts || windowType == OutlookWindowTypes.Calendar); }
/// <summary> /// Returns the name of the contextual menu for the window/element /// currently in focus. /// </summary> /// <param name="windowType">Type of window</param> /// <param name="title">returns the title</param> /// <returns>name of the panel</returns> protected String getContextualMenuForWindow(OutlookWindowTypes windowType, ref String title) { Log.Debug("windowType: " + windowType); String scannerName; title = PanelTitle; switch (windowType) { case OutlookWindowTypes.EmailMessage: scannerName = "OutlookBrowseEmailContextMenu"; title = "Mail"; break; case OutlookWindowTypes.NewEmailMessage: scannerName = "OutlookNewEmailContextMenu"; title = "Mail"; break; case OutlookWindowTypes.Inbox: scannerName = "OutlookContextMenu"; title = "Mail"; break; case OutlookWindowTypes.Calendar: scannerName = "OutlookContextMenu"; title = "Calendar"; break; case OutlookWindowTypes.Tasks: scannerName = "OutlookContextMenu"; title = "Tasks"; break; case OutlookWindowTypes.Contacts: scannerName = "OutlookContextMenu"; title = "Contacts"; break; case OutlookWindowTypes.Notes: scannerName = "OutlookContextMenu"; title = "Notes"; break; case OutlookWindowTypes.OpenNote: scannerName = PanelClasses.Alphabet; title = "Note"; break; case OutlookWindowTypes.AppointmentScheduling: case OutlookWindowTypes.OpenAppointment: scannerName = "OutlookOpenAppointmentContextMenu"; title = "Appointment"; break; case OutlookWindowTypes.OpenContact: scannerName = "OutlookOpenContactContextMenu"; title = "Contact"; break; case OutlookWindowTypes.OpenTask: scannerName = "OutlookOpenTaskContextMenu"; title = "Task"; break; case OutlookWindowTypes.AddressBookDetails: case OutlookWindowTypes.AddressBook: scannerName = "OutlookAddressBookContextMenu"; title = "Addr. Book"; break; default: scannerName = "OutlookContextMenu"; break; } return scannerName; }
/// <summary> /// Checks if the specified window is a top-level window in Outlook /// </summary> /// <param name="windowType">window type</param> /// <returns>true if it is</returns> private bool isTopLevelWindow(OutlookWindowTypes windowType) { return (windowType == OutlookWindowTypes.Tasks || windowType == OutlookWindowTypes.Notes || windowType == OutlookWindowTypes.Inbox || windowType == OutlookWindowTypes.Contacts || windowType == OutlookWindowTypes.Calendar); }