/// <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 (System.Exception ex) { Debug.WriteLine(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void WrappedWindow_InvalidateControl(object sender, OutlookExplorer.InvalidateEventArgs e) { if (m_Ribbon != null) { m_Ribbon.InvalidateControl(e.ControlID); } }
/// <summary> /// Implements the OnStartupComplete method of the IDTExtensibility2 interface. /// Receives notification that the host application has completed loading. /// </summary> /// <param term='custom'> /// Array of parameters that are host application specific. /// </param> /// <seealso class='IDTExtensibility2' /> public void OnStartupComplete(ref System.Array custom) { // This method is called after the host application has completed loading. At this point, all host resources are available for use // by the Add-in. This is an ideal place to construct the UI of your Add-in types, as you can safely obtain the set of Explorers and Inspectors. m_Explorers = m_OutlookAppObj.Explorers; m_Windows = new List<OutlookExplorer>(); // Wire up event handlers to handle multiple Explorer windows m_Explorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(m_Explorers_NewExplorer); // Add the ActiveExplorer to m_Windows Outlook.Explorer expl = m_OutlookAppObj.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); }