private void ExpressTagButtonsFromBackend(OutlookTagBarContext localTaggingContext)
 {
     if (localTaggingContext.isRead())
     {
         string         entryID  = localTaggingContext.GetEmailBeingRead().EntryID;
         string         json     = TagCommon.Backend.TagsForEmail(entryID);
         TagNames       tagNames = TagCommon.Utils.GetTagNamesForJson(json);
         List <TagName> tags     = tagNames.Tags;
         foreach (TagName tag in tags)
         {
             AddNewButton(tag.Name, localTaggingContext);
         }
     }
     else if (localTaggingContext.isReply())
     {
         string         entryID  = localTaggingContext.GetEmailBeingRepliedTo().EntryID;
         string         json     = TagCommon.Backend.TagsForEmail(entryID);
         TagNames       tagNames = TagCommon.Utils.GetTagNamesForJson(json);
         List <TagName> tags     = tagNames.Tags;
         foreach (TagName tag in tags)
         {
             AddNewButton(tag.Name, localTaggingContext);
         }
     }
     else if (localTaggingContext.isExplorerInit())
     {
         // skip it - the CurrentExplorer_SelectionChanged event will trigger the refresh in a bit
     }
     else if (localTaggingContext.isCompose())
     {
         throw new TagServicesException("refreshTagButtons not implemented for Compose state");
     }
 }
        public void SetLocalTaggingContext(OutlookTagBarContext context)
        {
            this.localTaggingContext = context;

            if (context.isRead())
            {
                SetContextID(context.GetEmailBeingRead().EntryID);
                RefreshTagButtons();
                Status("read...");
            }
            else if (context.isReply())
            {
                SetContextID(context.GetEmailBeingRepliedTo().EntryID);
                RefreshTagButtons();
                Status("reply...");
            }
            else if (context.isExplorerInit())
            {
                Status("expl init...");
            }
            else if (context.isCompose())
            {
                throw new TagServicesException("isCompose case Not Yet Implemented for OutlookTag Bar");
            }
        }
 private void AddNewButton(String name, OutlookTagBarContext localTaggingContext)
 {
     if (!this.tagBar.IsButtonAlreadyPresent(name))
     {
         Button newButton = CreateButton(name, localTaggingContext);
         this.tagBar.AddAndPositionTagButton(newButton);
     }
 }
        private Button CreateButton(String text, OutlookTagBarContext localTaggingContext)
        {
            Button newButton = new TagButton(text);

            newButton.Click += new EventHandler(TagButton_Click);
            if (localTaggingContext.isReply())
            {
                AddMenusToButtonFromBackend(newButton, localTaggingContext.GetReplyEmail());
            }
            else if (localTaggingContext.isRead())
            {
                AddAttachmentsMenu(newButton, localTaggingContext.GetEmailBeingRead());
            }
            else
            {
                throw new TagServicesException("create tag button only implemented for read, reply so far");
            }
            return(newButton);
        }
 public OutlookTagBarDecorator(OutlookTagBarAddin addin, TagBar tagBar, OutlookTagBarContext localTaggingContext)
 {
     this.addin  = addin;
     this.tagBar = tagBar;
     SetLocalTaggingContext(localTaggingContext);
 }