Esempio n. 1
0
        public List <AnnotationTag> GenerateTagsFromTagXML(string categoryTagXml)
        {
            XDocument doc  = XDocument.Parse(categoryTagXml);
            XElement  root = doc.Element("AnnotationTags");

            if (root != null)
            {
                var elements = root.Elements("AnnotationTag");
                if (elements != null)
                {
                    List <AnnotationTag> tagList = new List <AnnotationTag>(elements.Count());
                    foreach (XElement el in root.Elements("AnnotationTag"))
                    {
                        AnnotationTag data = new AnnotationTag
                        {
                            TagId     = (Guid)el.Attribute("TagID"),
                            Color     = (string)el.Attribute("Color"),
                            Title     = (string)el.Element("Title"),
                            SortOrder = (int)el.Attribute("SortOrder")
                        };
                        tagList.Add(data);
                    }
                    return(tagList);
                }
            }
            return(null);
        }
Esempio n. 2
0
        public static AnnotationTag ToAnnotationTagEntity(this TagModel model)
        {
            var entity = new AnnotationTag
            {
                TagId = model.id
            };

            return(entity);
        }
Esempio n. 3
0
        private void saveAnnotation(object state)
        {
            var annotationAndTags = (annotationAndTags)state;

            Annotation annotation = new Annotation()
            {
                StartIndex            = currentSelection.CharIndex,
                SourceLength          = currentSelection.CharLength,
                SourceText            = currentText.ID,
                Content               = annotationAndTags.Annotation,
                Author                = currentUser.ID,
                UpVotes               = 0,
                DownVotes             = 0,
                HighlightedSourceText = string.Concat((this.textRoot.SelectedContent.Content as TextControl).body.Selection.Text.Take(100)),
                Timestamp             = DateTime.Now
            };


            db.Annotations.AddObject(annotation);
            db.SaveChanges();

            List <int>    tagIDs    = new List <int>();
            List <string> inputTags = annotationAndTags.Tags;

            foreach (var tag in inputTags)
            {
                var resolvedTag = db.Tags.Where(i => i.Name == tag).SingleOrDefault();
                if (resolvedTag == null)
                {
                    var newTag = new Tag()
                    {
                        Name = tag
                    };
                    db.Tags.AddObject(newTag);
                    db.SaveChanges();
                    tagIDs.Add(newTag.ID);
                }
                else
                {
                    tagIDs.Add(resolvedTag.ID);
                }
            }

            foreach (var id in tagIDs)
            {
                var annotationTag = new AnnotationTag()
                {
                    AnnotationID = annotation.ID, TagID = id
                };
                db.AnnotationTags.AddObject(annotationTag);
                db.SaveChanges();
            }

            Dispatcher.Invoke((Action)(() => {
                loadAnnotations();
            }));
        }
        public void AddTagToTableView(string color, string title)
        {
            var newTag = new AnnotationTag();

            newTag.Color = color;
            newTag.Title = title;
            TagsList.Add(newTag);
            TagTableView.ReloadData();
        }
Esempio n. 5
0
        internal bool AddTagInstance(int tagModelId)
        {
            AnnotationTag         model    = DbContext.AnnotationTags.Single(m => m.Id == tagModelId);
            AnnotationTagInstance instance = new AnnotationTagInstance(model);

            DbContext.AnnotationTagInstances.Add(instance);
            DbContext.SaveChanges();
            return(true);
        }
Esempio n. 6
0
        public EntityResult AddTag(TagFormModel tagModel)
        {
            var tag = new AnnotationTag(tagModel);

            DbContext.AnnotationTags.Add(tag);
            DbContext.SaveChanges();

            return(EntityResult.Successfull(tag.Id));
        }
Esempio n. 7
0
 private void OnEditTag(AnnotationTag tag)
 {
     NewEditTagDialogFragment.NewInstance(
         tag.TagId.ToString(),
         tag.Title,
         tag.Color).Show(
         Activity.SupportFragmentManager.BeginTransaction(),
         NewEditTagDialogFragment.NewEditTagDialogFragmentTag);
     Dismiss();
 }
        private void UpdateTextPosition(AnnotationTag tag)
        {
            var delta    = this.ActualWidth * (tag.Message.Data.StartTime - this.navigator.ViewRange.StartTime).Ticks / this.navigator.ViewRange.Duration.Ticks;
            var duration = this.ActualWidth * (tag.Message.Data.EndTime - tag.Message.Data.StartTime).Ticks / this.navigator.ViewRange.Duration.Ticks;

            tag.TextBlock.SetValue(Canvas.LeftProperty, (double)delta);
            tag.TextBlock.Height     = this.ActualHeight;
            tag.TextBlock.Width      = duration;
            tag.TextBlock.Foreground = new SolidColorBrush(this.AnnotatedEventVisualizationObject.Configuration.TextColor);
        }
Esempio n. 9
0
        private bool HasDuplicateParent(AnnotationTag original, AnnotationTag check)
        {
            var duplicate = original.Id == check.Id;

            if (duplicate)
            {
                return(true);
            }
            else
            {
                return(check.ParentTagId != null && HasDuplicateParent(original, DbContext.AnnotationTags.Single(t => t.Id == check.ParentTagId)));
            }
        }
Esempio n. 10
0
        public static TagModel ToTagModel(this AnnotationTag entity)
        {
            if (entity == null || entity.Tag == null)
            {
                return(null);
            }

            var model = new TagModel
            {
                id   = entity.Tag.TagId,
                Name = entity.Tag.TagName
            };

            return(model);
        }
Esempio n. 11
0
        public void DeleteTag(AnnotationTag tag)
        {
            var index = tagList.FindIndex(at => at.Data.TagId == tag.TagId);

            if (index >= 0)
            {
                if (deleteTagAction != null)
                {
                    deleteTagAction(tag);
                }

                tagList.RemoveAt(index);
                this.NotifyItemRemoved(index);
            }
        }
Esempio n. 12
0
        public void DragItemFromIndexToIndex(NSTableView tableView, int dragRow, int toRow)
        {
            IsDraggedTag = true;

            //Console.WriteLine("from:{0} to:{1}", dragRow, toRow);
            AnnotationTag dragItem = TagsList [dragRow];

            if (dragRow < toRow)
            {
                TagsList.Insert(toRow, dragItem);
                TagsList.RemoveAt(dragRow);
            }
            else
            {
                TagsList.RemoveAt(dragRow);
                TagsList.Insert(toRow, dragItem);
            }
        }
        private void AddTag(Message <AnnotatedEvent> annotatedEvent)
        {
            if (!this.startTime.HasValue)
            {
                this.startTime = annotatedEvent.Data.StartTime;
                this.CalculateXTransform();
            }

            TimeSpan start = annotatedEvent.Data.StartTime - this.startTime.Value;
            Rect     rect  = new Rect(start.TotalSeconds, 0.0, annotatedEvent.Data.Duration.TotalSeconds, 1);
            var      tag   = new AnnotationTag(this, annotatedEvent, rect);

            this.tags.Add(tag);
            this.DynamicCanvas.Children.Add(tag.RectanglePath);
            this.DynamicCanvas.Children.Add(tag.TextBlock);
            this.UpdateTextColor(tag);
            this.UpdateTextPosition(tag);
        }
Esempio n. 14
0
        public AnnotationTag AddAndReturnTag(string title, string color)
        {
            AnnCategorytag.IsModified = true;
            var newTag = new AnnotationTag
            {
                Title     = title,
                Color     = color,
                TagId     = Guid.NewGuid(),
                SortOrder = Tags.Count + 1
            };

            Tags.Add(newTag);
            if (SaveToSqliteWithSynctags() > 0)
            {
                return(newTag);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 15
0
        public void AddTagToTableView(string color, string title)
        {
            if (this.IsTagEdit)
            {
                var curTag = TagsList [this.CurrentTagIndex];
                curTag.Color = color;
                curTag.Title = title;
                AnnCategoryTagUtil.Instance.UpdateTag(curTag.TagId, title, color);
            }
            else
            {
                var newTag = new AnnotationTag();
                newTag.Color = color;
                newTag.Title = title;
                Guid id = AnnCategoryTagUtil.Instance.AddTag(title, color);
                newTag.TagId = id;

                TagsList.Add(newTag);
            }

            TagTableView.ReloadData();
        }
Esempio n. 16
0
        public void ReloadAnnotationData()
        {
            if (AnnCategoryTagUtil.Instance == null)
            {
                return;
            }
            if (TagsList == null)
            {
                TagsList = new List <AnnotationTag> ();
            }
            else
            {
                TagsList.Clear();
            }

            var tag = new AnnotationTag();

            tag.Color = string.Empty;
            tag.Title = "All Tags";
            tag.TagId = Guid.Empty;
            TagsList.Add(tag);

            var noTag = new AnnotationTag();

            noTag.Color = string.Empty;
            noTag.Title = "No tag";
            noTag.TagId = Guid.Empty;
            TagsList.Add(noTag);

            var tags = AnnCategoryTagUtil.Instance.GetTags();

            TagsList.AddRange(tags);

            if (TagsTableView != null)
            {
                TagsTableView.ReloadData();
            }
        }
        /// <summary>
        /// Should return code 200 and a list of all tag relations that are available for the given tag instance
        /// </summary>
        // TODO  [Test]
        public void GetAvailableRelationsForIdTest()
        {
            var tag5 = new AnnotationTag()
            {
                Id = 5
            };
            var relation35 = new AnnotationTagRelation(_tag3, tag5);
            var expected   = new List <AnnotationTagRelation>()
            {
                _relation34, relation35
            };
            var instance3 = new AnnotationTagInstance(_tag3);
            var instances = new List <AnnotationTagInstance>()
            {
                new AnnotationTagInstance(_tag1),
                new AnnotationTagInstance(_tag2),
                instance3,
                new AnnotationTagInstance(_tag4),
                new AnnotationTagInstance(tag5)
            };

            MyMvc
            .Controller <AnnotationController>()
            .WithAuthenticatedUser(user => user.WithClaim("Id", "1"))
            .WithDbContext(dbContext => dbContext
                           .WithSet <User>(db => db.Add(_admin))
                           .WithSet <AnnotationTag>(db => db.AddRange(_tag1, _tag2, _tag3, _tag4))
                           .WithSet <AnnotationTagRelation>(db => db.AddRange(_relation12, _relation34, relation35))
                           // TODO How to model that the tag instances are part of the same document?
                           )
            .Calling(c => c.GetAvailableRelationsForInstance(instance3.Id))
            .ShouldReturn()
            .Ok()
            .WithModelOfType <List <AnnotationTagRelation> >()
            .Passing(actual => expected.SequenceEqual(actual));
        }
 public SelectableAnnotationTag(TagType type, bool selected)
 {
     Tag      = null;
     Selected = selected;
     Type     = type;
 }
 public SelectableAnnotationTag(AnnotationTag tag, bool selected)
 {
     Tag      = tag;
     Selected = selected;
     Type     = TagType.Normal;
 }
Esempio n. 20
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            PublicationAnnotationCell cell = tableView.DequeueReusableCell(PublicationAnnotationCell.Key) as PublicationAnnotationCell;

            if (cell == null)
            {
                cell = PublicationAnnotationCell.Create();
            }
            cell.SelectionStyle = UITableViewCellSelectionStyle.None;

            var     annotation = AnnoListDict [SectionTitleArr [indexPath.Section]] [indexPath.Row];
            UIColor TextColor  = ColorUtil.ConvertFromHexColorCode("#959595");

            DateTime date = annotation.UpdatedTime;

            cell.dateLabel.TextColor = TextColor;
            cell.dateLabel.Text      = date.ToString("dd MMM yyyy");

            cell.TocLabel.Text      = annotation.TOCTitle;
            cell.TocLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#000000");

            cell.conLabel.Text      = annotation.HighlightText;
            cell.conLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#000000");

            cell.imageIma.Image      = new UIImage("Images/Setting/About.png");
            cell.NoteLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#cccccc");
            if (annotation.NoteText != "")
            {
                cell.NoteLabel.Text = annotation.NoteText;
            }
            else
            {
                cell.NoteLabel.Text = "Add a note...";
            }

            nfloat TagHeight = (tableView.Frame.Size.Width - 60 * 4) / 5;

            getGuidList = annotation.CategoryTags;
            if (getGuidList.Count == 0)
            {
                UIView emptyBtn = new UIView(new CGRect(3, 5, 10, 10));
                emptyBtn.BackgroundColor    = UIColor.White;
                emptyBtn.Layer.BorderColor  = ColorUtil.ConvertFromHexColorCode("#cccccc").CGColor;
                emptyBtn.Layer.BorderWidth  = 1;
                emptyBtn.Layer.CornerRadius = 10 / 2;

                UILabel emptyLabel = new UILabel(new CGRect(25, 0, 120, 18));
                emptyLabel.Text      = "Add a tag...";
                emptyLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#cccccc");
                emptyLabel.Font      = UIFont.SystemFontOfSize(14);
                cell.bgView.AddSubview(emptyLabel);
                cell.bgView.AddSubview(emptyBtn);
            }
            else
            {
                for (int i = 0; i < getGuidList.Count; i++)
                {
                    AnnotationTag tag          = getGuidList [i];
                    UIColor       defaultColor = ColorUtil.ConvertFromHexColorCode(tag.Color);
                    TagsButton    btn          = new TagsButton();
                    btn.Frame                     = new CGRect((TagHeight + 60) * (i % 4) - 15 + TagHeight, (i / 4) * 25, 60, 30);
                    btn.BackgroundColor           = UIColor.White;
                    btn.ColorView.BackgroundColor = defaultColor;
                    btn.ColorLabel.Text           = tag.Title;
                    cell.bgView.AddSubview(btn);
                }
            }
            return(cell);
        }
 private void UpdateTextColor(AnnotationTag tag)
 {
     tag.TextBlock.Foreground = new SolidColorBrush(this.AnnotatedEventVisualizationObject.Configuration.TextColor);
 }
        public void BeforeTest()
        {
            // create some User, Tag and TagRelation objects for mocking the database
            _admin = new User
            {
                Id    = 1,
                Email = "*****@*****.**",
                Role  = "Administrator"
            };
            _student = new User
            {
                Id    = 2,
                Email = "*****@*****.**",
                Role  = "Student"
            };
            _supervisor = new User
            {
                Id    = 3,
                Email = "*****@*****.**",
                Role  = "Supervisor"
            };

            /*
             * Layer1   Layer2
             * |-tag1   |-tag2
             * |-tag3   |-tag4
             *
             * Layer Relation Rules:
             * Layer1 -> Layer2
             *
             * Annotation Tag Relations:
             * tag1 -> tag2
             * tag3 -> tag2
             * tag3 -> tag4
             */
            _layer1 = new Layer()
            {
                Id = 1, Name = "Time"
            };
            _layer2 = new Layer()
            {
                Id = 2, Name = "Perspective"
            };
            _tag1 = new AnnotationTag()
            {
                Id = 1, Layer = _layer1.Name
            };
            _tag2 = new AnnotationTag()
            {
                Id = 2, Layer = _layer2.Name
            };
            _tag3 = new AnnotationTag()
            {
                Id = 3, Layer = _layer1.Name
            };
            _tag4 = new AnnotationTag()
            {
                Id = 4, Layer = _layer2.Name
            };
            _tag1.ChildTags = new List <AnnotationTag>()
            {
                _tag3
            };
            _tag2.ChildTags = new List <AnnotationTag>()
            {
                _tag4
            };
            _relation12        = new AnnotationTagRelation(_tag1, _tag2);
            _relation34        = new AnnotationTagRelation(_tag3, _tag4);
            _layerRelationRule = new LayerRelationRule()
            {
                SourceLayer   = _layer1,
                SourceLayerId = _layer1.Id,
                TargetLayer   = _layer2,
                TargetLayerId = _layer2.Id,
                Color         = "test-color",
                ArrowStyle    = "test-style"
            };
        }
Esempio n. 23
0
        private void RemoveRelationFor(AnnotationTag source, AnnotationTag target)
        {
            var relation = DbContext.AnnotationTagRelations.Single(rel => rel.SourceTagId == source.Id && rel.TargetTagId == target.Id);

            DbContext.AnnotationTagRelations.Remove(relation);
        }
Esempio n. 24
0
 private bool TagRelationExists(AnnotationTag tag1, AnnotationTag tag2)
 {
     return(tag1 != null &&
            tag2 != null &&
            DbContext.AnnotationTagRelations.Any(rel => rel.SourceTagId == tag1.Id && rel.TargetTagId == tag2.Id));
 }
        public ControllerTester()
        {
            Admin = new User
            {
                Id    = 1,
                UId   = AdminUId,
                Email = "*****@*****.**",
                Role  = "Administrator"
            };
            Student = new User
            {
                Id    = 2,
                UId   = StudentUId,
                Email = "*****@*****.**",
                Role  = "Student"
            };
            Supervisor = new User
            {
                Id    = 3,
                UId   = SupervisorUId,
                Email = "*****@*****.**",
                Role  = "Supervisor"
            };
            Reviewer = new User
            {
                Id    = 6,
                UId   = ReviewerUId,
                Email = "*****@*****.**",
                Role  = "Reviewer"
            };

            /*
             * Layer1   Layer2
             * |-tag1   |-tag2
             * |-tag3   |-tag4
             *
             * Layer Relation Rules:
             * Layer1 -> Layer2
             *
             * Annotation AnnotationTag Relations:
             * tag1 -> tag2
             * tag3 -> tag2
             * tag3 -> tag4
             */
            Layer1 = new Layer()
            {
                Id = 1, Name = "Time"
            };
            Layer2 = new Layer()
            {
                Id = 2, Name = "Perspective"
            };
            Tag1 = new AnnotationTag()
            {
                Id = 1, Layer = Layer1.Name
            };
            Tag2 = new AnnotationTag()
            {
                Id = 2, Layer = Layer2.Name
            };
            Tag3 = new AnnotationTag()
            {
                Id = 3, Layer = Layer1.Name
            };
            Tag4 = new AnnotationTag()
            {
                Id = 4, Layer = Layer2.Name
            };
            Tag1.ChildTags = new List <AnnotationTag>()
            {
                Tag3
            };
            Tag2.ChildTags = new List <AnnotationTag>()
            {
                Tag4
            };
            RelationRule12 = new AnnotationTagRelationRule()
            {
                Id = 3, SourceTagId = Tag1.Id, TargetTagId = Tag2.Id, Title = "Tag Relation Rule 1->2"
            };
            RelationRule32 = new AnnotationTagRelationRule()
            {
                Id = 5, SourceTagId = Tag3.Id, TargetTagId = Tag2.Id, Title = "Tag Relation Rule 3->2"
            };
            RelationRule34 = new AnnotationTagRelationRule()
            {
                Id = 7, SourceTagId = Tag3.Id, TargetTagId = Tag4.Id, Title = "Tag Relation Rule 3->4"
            };
            TagInstance1 = new AnnotationTagInstance(Tag1)
            {
                Id = 1
            };
            TagInstance2 = new AnnotationTagInstance(Tag2)
            {
                Id = 2
            };
            TagInstance3 = new AnnotationTagInstance(Tag3)
            {
                Id = 3
            };
            TagInstance4 = new AnnotationTagInstance(Tag4)
            {
                Id = 4
            };
            Relation12 = new AnnotationTagInstanceRelation(TagInstance1, TagInstance2)
            {
                Id = 3
            };
            Relation32 = new AnnotationTagInstanceRelation(TagInstance3, TagInstance2)
            {
                Id = 5
            };
            Relation34 = new AnnotationTagInstanceRelation(TagInstance3, TagInstance4)
            {
                Id = 7
            };
            LayerRelationRule = new LayerRelationRule()
            {
                Id            = 3,
                SourceLayer   = Layer1,
                SourceLayerId = Layer1.Id,
                TargetLayer   = Layer2,
                TargetLayerId = Layer2.Id,
                Color         = "test-color",
                ArrowStyle    = "test-style"
            };
            TopicOne = new Topic
            {
                Id          = 1,
                Title       = "Paderborner Dom",
                Status      = "InReview",
                Deadline    = new DateTime(2017, 5, 04),
                CreatedById = Supervisor.Id,
                Description = "Church"
            };
            TopicTwo = new Topic
            {
                Id          = 2,
                Title       = "Westerntor",
                Status      = "InProgress",
                Deadline    = new DateTime(2017, 4, 18),
                CreatedById = Supervisor.Id,
                Description = "Shopping"
            };
            UnreadNotification = new Notification
            {
                NotificationId = 1,
                UserId         = Student.Id,
                UpdaterId      = Supervisor.Id,
                Type           = NotificationType.TOPIC_ASSIGNED_TO,
                TopicId        = TopicOne.Id,
                IsRead         = false
            };
            ReadNotification = new Notification
            {
                NotificationId = 2,
                UserId         = Student.Id,
                UpdaterId      = Supervisor.Id,
                Type           = NotificationType.TOPIC_ASSIGNED_TO,
                TopicId        = TopicTwo.Id,
                IsRead         = true
            };
            Subscription = new Subscription // Adding a new subscription
            {
                SubscriptionId = 1,
                SubscriberId   = Student.Id,
                Subscriber     = Student,
                Type           = NotificationType.TOPIC_ASSIGNED_TO
            };
            SupervisorUser = new TopicUser
            {
                TopicId = TopicOne.Id,
                UserId  = Supervisor.Id,
                Role    = Supervisor.Role
            };
            StudentUser = new TopicUser
            {
                TopicId = TopicOne.Id,
                UserId  = Student.Id,
                Role    = Student.Role
            };
            ReviewerUser = new TopicUser
            {
                TopicId = TopicOne.Id,
                UserId  = Reviewer.Id,
                Role    = Reviewer.Role
            };
            FirstDocument = new Document
            {
                TopicId   = TopicOne.Id,
                UpdaterId = Admin.Id,
                Content   = "Hello"
            };
            TagInstanceForDocument = new AnnotationTagInstance
            {
                Id         = 5,
                TagModelId = Tag1.Id,
                Document   = FirstDocument
            };
        }
Esempio n. 26
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            CustomizedAnnotationTableViewCell cell = tableView.DequeueReusableCell(CustomizedAnnotationTableViewCell.Key) as CustomizedAnnotationTableViewCell;

            if (cell == null)
            {
                cell = CustomizedAnnotationTableViewCell.Create();
            }
            cell.SelectionStyle = UITableViewCellSelectionStyle.None;

            if (AnnotationList.Count != 0)
            {
                var annotation = AnnotationList[indexPath.Row];

                cell.PublicationNameLabel.Text = annotation.BookTitle;
                DateTime date = annotation.UpdatedTime;

                cell.DateLabel.Text = date.ToString("dd MMM yyyy");
                string guidCardTitle = annotation.GuideCardName + ">" + annotation.TOCTitle;
                cell.GuidecardLabel.Text     = guidCardTitle;
                cell.HighlightTextLabel.Text = annotation.HighlightText;

                cell.NoteLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#cccccc");
                if (annotation.NoteText != "")
                {
                    cell.NoteLabel.Text = annotation.NoteText;
                }
                else
                {
                    cell.NoteLabel.Text = "Add a note...";
                }
                getGuidList = annotation.CategoryTags;
                nfloat TagHeight = (tableView.Frame.Size.Width - 60 * 8) / 9;
                if (getGuidList.Count == 0)
                {
                    UIView emptyBtn = new UIView(new CGRect(0, 10, 10, 10));
                    emptyBtn.BackgroundColor    = UIColor.White;
                    emptyBtn.Layer.BorderColor  = ColorUtil.ConvertFromHexColorCode("#cccccc").CGColor;
                    emptyBtn.Layer.BorderWidth  = 1;
                    emptyBtn.Layer.CornerRadius = 10 / 2;

                    UILabel emptyLabel = new UILabel(new CGRect(18, 5, 120, 18));
                    emptyLabel.Text      = "Add a tag...";
                    emptyLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#cccccc");
                    emptyLabel.Font      = UIFont.SystemFontOfSize(14);
                    cell.TagContainerView.AddSubview(emptyLabel);
                    cell.TagContainerView.AddSubview(emptyBtn);
                }
                else
                {
                    for (int i = 0; i < getGuidList.Count; i++)
                    {
                        AnnotationTag tag          = getGuidList[i];
                        UIColor       defaultColor = ColorUtil.ConvertFromHexColorCode(tag.Color);
                        TagsButton    btn          = new TagsButton();
                        btn.Frame                     = new CGRect((TagHeight + 60) * (i % 8), (i / 8) * 25, 60, 30);
                        btn.BackgroundColor           = UIColor.White;
                        btn.ColorView.BackgroundColor = defaultColor;
                        btn.ColorLabel.Text           = tag.Title;
                        btn.Layer.BorderColor         = UIColor.Clear.CGColor;
                        btn.Layer.BorderWidth         = 1;
                        btn.Layer.CornerRadius        = 10 / 2;
                        btn.ClipsToBounds             = true;
                        cell.TagContainerView.AddSubview(btn);
                    }
                }
            }

            cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            return(cell);
        }
        public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            return(null);

            string          title         = null;
            NSTableCellView tableCellView = null;

            if (GroupIndexSet.Contains((nuint)row))
            {
                tableCellView = (NSTableCellView)tableView.MakeView("GROUPITEM", this);

                int idx = GetTitleIndexWithRowValue(row);

                tableCellView.TextField.StringValue = GuidCardList[idx];
                tableCellView.WantsLayer            = true;
                tableCellView.Layer.BackgroundColor = NSColor.Control.CGColor;

                return(tableCellView);
            }

            int index   = Convert.ToInt32(row);
            var dataRow = AnnotationList[index];

            string valueKey = "ANNOTATIONITEM";

            tableCellView = (NSTableCellView)tableView.MakeView(valueKey, this);

            var viewList = tableCellView.Subviews;

            NSTextField dateTF = (NSTextField)viewList [0];

            dateTF.Cell.Wraps           = true;
            dateTF.Cell.DrawsBackground = true;
            dateTF.Cell.BackgroundColor = NSColor.Clear;
            dateTF.StringValue          = Utility.FormateLastReadDate(dataRow.UpdatedTime);
            dateTF.ToolTip = Utility.FormateLastReadDate(dataRow.UpdatedTime);

            NSTextField tocTF = (NSTextField)viewList [1];

            tocTF.Cell.Wraps           = true;
            tocTF.Cell.DrawsBackground = true;
            tocTF.Cell.BackgroundColor = NSColor.Clear;
            tocTF.StringValue          = dataRow.TOCTitle;
            tocTF.ToolTip = dataRow.TOCTitle;

            NSTextField highlightTF = (NSTextField)viewList [2];

            if (!string.IsNullOrEmpty(dataRow.HighlightText))
            {
                highlightTF.StringValue = string.Empty;
                highlightTF.Hidden      = true;
            }
            else
            {
                highlightTF.Cell.Wraps           = true;
                highlightTF.Cell.DrawsBackground = true;
                highlightTF.Cell.BackgroundColor = NSColor.Clear;
                highlightTF.StringValue          = dataRow.HighlightText;
                highlightTF.ToolTip = dataRow.HighlightText;
            }

            NSTextField noteTF = (NSTextField)viewList [3];

            if (!string.IsNullOrEmpty(dataRow.NoteText))
            {
                noteTF.StringValue = string.Empty;
                noteTF.Hidden      = true;
            }
            else
            {
                noteTF.Cell.Wraps           = true;
                noteTF.Cell.DrawsBackground = true;
                noteTF.Cell.BackgroundColor = NSColor.Clear;
                noteTF.StringValue          = dataRow.NoteText;
                noteTF.ToolTip = dataRow.NoteText;

                NSImageView imageView = (NSImageView)viewList [5];
                imageView.Image = Utility.ImageWithFilePath("/Images/Annotation/note");
            }


            NSView tagView = (NSView)viewList [4];

            var taglist = dataRow.CategoryTagIDs;

            for (int i = 0; i < taglist.Count; i++)
            {
                NSButton      tagButton = new NSButton(MakeButtonRectAtIndex(i));
                AnnotationTag tag       = new AnnotationTag();          //AnnCategoryTagUtil.Instance.GetTagByGuid ();
                tagButton.Image = CreateImageWithColor("#00ff00");      //tag.Color;
                tagButton.Title = tag.Title;
                tagView.AddSubview(tagButton);
            }

            return(tableCellView);
        }
Esempio n. 28
0
 public Tag(AnnotationTag at, bool isSelected = false)
 {
     AnnoTag    = at;
     IsSelected = isSelected;
 }
Esempio n. 29
0
 private void OnDeleteTag(AnnotationTag tag)
 {
     AnnCategoryTagUtil.Instance.DeleteTag(tag.TagId);
     NotifyTagListChanged();
 }