Beispiel #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);
         }
     }
 }
Beispiel #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);
            }
        }
        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);
            }
        }