public InspectorWrapper(OutlookTagBarAddin addin, Outlook.Inspector Inspector, Outlook.MailItem mailItem) { this.mailItem = mailItem; this.inspector = Inspector; ((Outlook.InspectorEvents_Event)inspector).Close += new Outlook.InspectorEvents_CloseEventHandler(InspectorWrapper_Close); logger.Info("ADDING taskPane (inspectorTagBar)\n"); inspectorTagBar = new TagBar(); inspectorTagBarDecorator = new OutlookTagBarDecorator(addin, inspectorTagBar, new OutlookTagBarContext(addin.GetGlobalTaggingContext())); inspectorTagBar.SetTagBarHelper(this.inspectorTagBarDecorator); inspectorTagBar.LoadTagList(Utils.GetLatestTagList()); taskPane = Globals.OutlookTagBarAddin.CustomTaskPanes.Add(inspectorTagBar, "Inspector Tag Bar", this.inspector); taskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionTop; taskPane.Height = 57; taskPane.Visible = true; taskPane.VisibleChanged += new EventHandler(TaskPane_VisibleChanged); }
void WindowActivateHandler(Word.Document doc, Word.Window window) { if (!(wordWrappersDict.ContainsKey(doc))) { ListCaptionsForTaskPaneWindows("before"); // remove redundant TaskPane if present String caption = GetCaptionStringFromDoc(doc); RemoveTaskPanesIfTheirWindowHasThisCaption(caption); List <String> tags = tagNameSource.GetNextTags(caption); TagBar tagBar = new TagBar(); this.primaryTagBarDecorator = new WordTagBarDecorator(); tagBar.SetTagBarHelper(this.primaryTagBarDecorator); DocumentWindowWrapper dww = new DocumentWindowWrapper(); CustomTaskPane ctp = dww.Wrap(this, doc, tags, tagBar); wordWrappersDict.Add(doc, dww); System.Diagnostics.Debug.Write("window caption for new taskPane " + window.Caption + "\n"); ListCaptionsForTaskPaneWindows("after"); } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { /** * This section from https://msdn.microsoft.com/en-us/library/bb296010.aspx is for the * case where the add in is loaded after outlook is already up, which I don't believe is * a use case we need to support, but leave this in case. */ inspectors = this.Application.Inspectors; inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler( Inspectors_NewInspector); currentExplorer = this.Application.ActiveExplorer(); foreach (Outlook.Inspector inspector in inspectors) { Inspectors_NewInspector(inspector); } /* * create the explorer tagBar */ this.explorerTagBar = new TagBar(); this.explorerTagBarDecorator = new OutlookTagBarDecorator(this, explorerTagBar, new OutlookTagBarContext(this.globalTaggingContext)); explorerTagBar.SetTagBarHelper(this.explorerTagBarDecorator); explorerCustomTaskPane = this.CustomTaskPanes.Add(explorerTagBar, "Explorer Tag Bar"); explorerCustomTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionTop; explorerCustomTaskPane.Height = 57; explorerTagBar.LoadTagList(Utils.GetLatestTagList()); explorerCustomTaskPane.Visible = true; // explorer event currentExplorer = this.Application.ActiveExplorer(); currentExplorer.SelectionChange += new Outlook.ExplorerEvents_10_SelectionChangeEventHandler(CurrentExplorer_SelectionChanged); // inspector event logger.Debug("WOOHOO Started Addin..."); }