void WrappedWindow_Close(object sender, EventArgs e) { OutlookExplorer window = (OutlookExplorer)sender; window.Close -= new EventHandler(WrappedWindow_Close); m_Windows.Remove(window); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { // Initialize variables. m_Application = this.Application; m_Explorers = m_Application.Explorers; m_Inspectors = m_Application.Inspectors; m_Windows = new List <OutlookExplorer>(); m_InspectorWindows = new List <OutlookInspector>(); // Wire up event handlers to handle multiple Explorer windows. m_Explorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(m_Explorers_NewExplorer); // Wire up event handler to handle multiple Inspector windows. m_Inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(m_Inspectors_NewInspector); // Add the ActiveExplorer to m_Windows. Outlook.Explorer expl = m_Application.ActiveExplorer() as Outlook.Explorer; OutlookExplorer window = new OutlookExplorer(expl); m_Windows.Add(window); // Hook up event handlers for window. window.Close += new EventHandler(WrappedWindow_Close); window.InvalidateControl += new EventHandler <OutlookExplorer.InvalidateEventArgs>(WrappedWindow_InvalidateControl); // Get IPictureDisp for CurrentUser on startup. try { Outlook.AddressEntry addrEntry = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry; if (addrEntry.Type == "EX") { Outlook.ExchangeUser exchUser = addrEntry.GetExchangeUser() as Outlook.ExchangeUser; m_pictdisp = exchUser.GetPicture() as stdole.IPictureDisp; } } catch (Exception ex) { // Write exception to debug window. Debug.WriteLine(ex.Message); } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { // Initialize variables. m_Application = this.Application; m_Explorers = m_Application.Explorers; m_Inspectors = m_Application.Inspectors; m_Windows = new List<OutlookExplorer>(); m_InspectorWindows = new List<OutlookInspector>(); // Wire up event handlers to handle multiple Explorer windows. m_Explorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(m_Explorers_NewExplorer); // Wire up event handler to handle multiple Inspector windows. m_Inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(m_Inspectors_NewInspector); // Add the ActiveExplorer to m_Windows. Outlook.Explorer expl = m_Application.ActiveExplorer() as Outlook.Explorer; OutlookExplorer window = new OutlookExplorer(expl); m_Windows.Add(window); // Hook up event handlers for window. window.Close += new EventHandler(WrappedWindow_Close); window.InvalidateControl += new EventHandler<OutlookExplorer.InvalidateEventArgs>(WrappedWindow_InvalidateControl); // Get IPictureDisp for CurrentUser on startup. try { Outlook.AddressEntry addrEntry = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry; if (addrEntry.Type == "EX") { Outlook.ExchangeUser exchUser = addrEntry.GetExchangeUser() as Outlook.ExchangeUser; m_pictdisp = exchUser.GetPicture() as stdole.IPictureDisp; } } catch (Exception ex) { // Write exception to debug window. Debug.WriteLine(ex.Message); } }
/// <summary> /// The NewExplorer event fires whenever a new Explorer is displayed. /// </summary> /// <param name="Explorer"></param> private void m_Explorers_NewExplorer(Outlook.Explorer Explorer) { try { // Check to see if this is a new window // we don't already track OutlookExplorer existingWindow = FindOutlookExplorer(Explorer); // If the m_Windows collection does not // have a window for this Explorer, // we should add it to m_Windows if (existingWindow == null) { OutlookExplorer window = new OutlookExplorer(Explorer); window.Close += new EventHandler(WrappedWindow_Close); window.InvalidateControl += new EventHandler <OutlookExplorer.InvalidateEventArgs>(WrappedWindow_InvalidateControl); m_Windows.Add(window); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
void WrappedWindow_InvalidateControl(object sender, OutlookExplorer.InvalidateEventArgs e) { if (m_Ribbon != null) { m_Ribbon.InvalidateControl(e.ControlID); } }
/// <summary> /// The NewExplorer event fires whenever a new Explorer is displayed. /// </summary> /// <param name="Explorer"></param> private void m_Explorers_NewExplorer(Outlook.Explorer Explorer) { try { // Check to see if this is a new window // we don't already track OutlookExplorer existingWindow = FindOutlookExplorer(Explorer); // If the m_Windows collection does not // have a window for this Explorer, // we should add it to m_Windows if (existingWindow == null) { OutlookExplorer window = new OutlookExplorer(Explorer); window.Close += new EventHandler(WrappedWindow_Close); window.InvalidateControl += new EventHandler<OutlookExplorer.InvalidateEventArgs>(WrappedWindow_InvalidateControl); m_Windows.Add(window); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }