示例#1
0
 private static void AddTagToInspectorEmailIfMatch(Outlook.Inspector inspector, String entryID, String tag)
 {
     if (inspector.CurrentItem is Outlook.MailItem)
     {
         Outlook.MailItem mailItem = inspector.CurrentItem as Outlook.MailItem;
         if (entryID.Equals(mailItem.EntryID))
         {
             InspectorWrapper iWrapper = InspectorWrapper.inspectorWrappersValue[inspector];
             TagBar           otb      = iWrapper.getTagBar();
             otb.TagBarHelper.AddNewButton(tag);
         }
     }
 }
示例#2
0
        public static void CreateNewTag(String tag, Outlook.Application application, TagBar explorerTagBar)
        {
            CategoryUtils.AddCategory(tag, application);
            Backend.AddTag(tag);
            List <String> latestTags = Utils.GetLatestTagList();

            /*
             * There might be more than one TagBar in play - one in the explorer and any number of inspectors.
             * Find them all and update their tagList
             */
            explorerTagBar.LoadTagList(latestTags);
            Dictionary <Outlook.Inspector, InspectorWrapper> .KeyCollection keys = InspectorWrapper.inspectorWrappersValue.Keys;
            foreach (Outlook.Inspector inspector in keys)
            {
                InspectorWrapper iWrapper = InspectorWrapper.inspectorWrappersValue[inspector];
                iWrapper.getTagBar().LoadTagList(latestTags);
            }
        }
示例#3
0
        private void CurrentExplorer_SelectionChanged()
        {
            System.Diagnostics.Debug.Write("CurrentExplorer_SelectionChanged event fired\n");
            try
            {
                if (this.Application.ActiveExplorer().Selection.Count > 0)
                {
                    Object selObject = this.Application.ActiveExplorer().Selection[1];
                    if (selObject is Outlook.MailItem)
                    {
                        Outlook.MailItem mailItem = selObject as Outlook.MailItem;
                        this.globalTaggingContext.SetMostRecentNavigatedToMailItem(mailItem);

                        HookEventHandlersToMailItem(mailItem);
                        this.explorerTagBarDecorator.SetLocalTaggingContext(new OutlookTagBarContext(this.globalTaggingContext));
                        inspectors = this.Application.Inspectors;
                        foreach (Outlook.Inspector inspector in inspectors)
                        {
                            InspectorWrapper iWrapper = InspectorWrapper.inspectorWrappersValue[inspector];
                            TagBar           otb      = iWrapper.getTagBar();
                            if (otb.TagBarHelper.GetContextID().Equals(mailItem.EntryID))
                            {
                                otb.TagBarHelper.RefreshTagButtons();
                            }
                        }
                        String senderName = mailItem.Sender.Name;
                        Backend.AddPerson(Utils.NormalizeName(senderName));
                        Backend.ShowPersons();
                        String entryID        = mailItem.EntryID;
                        String conversationID = mailItem.ConversationID;
                        Backend.AddEmail(entryID, conversationID);
                        System.Diagnostics.Debug.Write("CurrentExplorer_SelectionChanged FIRED \n");
                    }
                }
            }
            catch (Exception e)
            {
                String expMessage = e.Message;
                System.Windows.Forms.MessageBox.Show(expMessage + "\n" + e.StackTrace);
            }
        }
示例#4
0
        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);
        }
示例#5
0
        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");
            }
        }
示例#6
0
        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...");
        }
        public CustomTaskPane Wrap(WordTagBarAddin addin, Word.Document Doc, List <String> tags, TagBar tagBar)
        {
            this.document = Doc;
            this.tags     = tags;
            Document vstoDoc = Globals.Factory.GetVstoObject(addin.Application.ActiveDocument);

            //System.Diagnostics.Debug.Write("ADDING taskPane (inspectorTagBar)\n");
            taskPane = Globals.WordTagBarAddin.CustomTaskPanes.Add(tagBar, "Tag Bar", this.document.ActiveWindow);
            taskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionTop;
            taskPane.Height       = 57;
            taskPane.Visible      = true;

            tagBar.TagBarHelper.RefreshTagButtons();
            System.Windows.Forms.ComboBox cb = tagBar.Controls["comboBox1"] as System.Windows.Forms.ComboBox;

            /*
             * cb.Items.Add("teaching\\cs500");
             * cb.Items.Add("teaching\\cs501");
             * cb.Items.Add("teaching\\cs502");
             * cb.Items.Add("teaching\\cs503");
             * cb.Items.Add("teaching\\cs504");
             * cb.Items.Add("teaching\\cs505");
             * cb.Items.Add("teaching\\cs506");
             * cb.Items.Add("teaching\\cs507");
             * // cb.Items.Add("word\\tags\\control render testing\\implement remove tag");
             * cb.SelectedIndex = 1;
             */
            return(taskPane);
        }
 public OutlookTagBarDecorator(OutlookTagBarAddin addin, TagBar tagBar, OutlookTagBarContext localTaggingContext)
 {
     this.addin  = addin;
     this.tagBar = tagBar;
     SetLocalTaggingContext(localTaggingContext);
 }