コード例 #1
0
 private void NewTag()
 {
     if (!string.IsNullOrEmpty(TagNameText) && SelectedTag > -1)
     {
         if (EditTagID == Guid.Empty)//New Tag
         {
             var tag     = AnnCategoryTagUtil.Instance.AddAndReturnTag(TagNameText, AnnotationTools.TagColors[SelectedTag].ColorValue);
             var tagItem = new TagItem
             {
                 Tag     = tag,
                 IsCheck = false
             };
             TagCollections.Add(tagItem);
         }
         else// Edit Tag
         {
             var tag          = AnnCategoryTagUtil.Instance.UpdateAndReturnTag(EditTagID, TagNameText, AnnotationTools.TagColors[SelectedTag].ColorValue);
             var editTagIndex = TagCollections.ToList <TagItem>().FindIndex(x => x.Tag.TagId == EditTagID);
             if (editTagIndex > -1)
             {
                 TagCollections[editTagIndex] = new TagItem
                 {
                     Tag     = tag,
                     IsCheck = TagCollections[editTagIndex].IsCheck
                 };
             }
         }
         SwitchAnnoAndTag(true);
     }
 }
コード例 #2
0
 private void TagOrderChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
     case NotifyCollectionChangedAction.Add:
         AnnCategoryTagUtil.Instance.Sort(TagCollections.Select(x => x.Tag).ToList <AnnotationTag>());
         break;
     }
 }
コード例 #3
0
        public void EditDialogOpen(Guid guid)
        {
            SwitchAnnoAndTag(false);
            var tag = TagCollections.FirstOrDefault(x => x.Tag.TagId == guid);

            SelectedTag = AnnotationTools.TagColors.FindIndex(x => x.ColorValue == tag.Tag.Color);
            EditTagID   = guid;
            NewTagTitle = ResourceLoader.GetString("EditTagTitle");
            TagNameText = tag.Tag.Title;
        }
コード例 #4
0
        public void DeleteTag(Guid guid)
        {
            AnnCategoryTagUtil.Instance.DeleteTag(guid);
            var deleteTag = TagCollections.FirstOrDefault(x => x.Tag.TagId == guid);

            if (deleteTag != null)
            {
                TagCollections.Remove(deleteTag);
            }
        }