public void AddTagToTableView(string color, string title)
        {
            var newTag = new AnnotationTag();

            newTag.Color = color;
            newTag.Title = title;
            TagsList.Add(newTag);
            TagTableView.ReloadData();
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            if (TagsList == null)
            {
                TagsList = new List <AnnotationTag> (0);
            }
            else
            {
                TagsList.Clear();
            }

            var tagList = AnnCategoryTagUtil.Instance.GetTags();

            if (tagList != null)
            {
                TagsList.AddRange(tagList);
            }

            TagTableView.UsesAlternatingRowBackgroundColors = false;
            TagTableView.SelectionHighlightStyle            = NSTableViewSelectionHighlightStyle.Regular;
            TagTableView.GridStyleMask = NSTableViewGridStyle.SolidHorizontalLine;
            TagTableView.EnclosingScrollView.BorderType = NSBorderType.BezelBorder;

            TagTableView.DataSource = new EditTagTableDataSource(TagsList, this);
            TagTableView.Delegate   = new EditTagTableDelegate(TagsList, this);
            TagTableView.ReloadData();

            var attributedTitle = Utility.AttributeTitle("Done", NSColor.Red, 13);

            DoneButton.AttributedTitle = attributedTitle;
            var alterTitle = Utility.AttributeTitle("Done", NSColor.DarkGray, 13);

            DoneButton.AttributedAlternateTitle = alterTitle;


//			TagTableView.SelectionShouldChange += (t) => true;
//			TagTableView.SelectionDidChange += ( sender,  e) =>
//				HandleSelectionDidChange ((NSNotification)sender);

            string[] typeArray = { "NSStringPboardType" };
            TagTableView.RegisterForDraggedTypes(typeArray);
        }
Esempio n. 3
0
        public override void ViewDidLoad()
        {
            if (TagsList == null)
            {
                TagsList = new List <AnnotationTag> (0);
            }
            else
            {
                TagsList.Clear();
            }

            var tagList = AnnCategoryTagUtil.Instance.GetTags();

            if (tagList != null)
            {
                TagsList.AddRange(tagList);
            }

            TagTableView.UsesAlternatingRowBackgroundColors               = false;
            TagTableView.EnclosingScrollView.ScrollerKnobStyle            = NSScrollerKnobStyle.Default;
            TagTableView.EnclosingScrollView.VerticalScroller.ControlSize = NSControlSize.Small;
            TagTableView.SelectionHighlightStyle             = NSTableViewSelectionHighlightStyle.Regular;
            TagTableView.EnclosingScrollView.BackgroundColor = NSColor.White;
            TagTableView.EnclosingScrollView.BorderType      = NSBorderType.BezelBorder;
            TagTableView.GridStyleMask = NSTableViewGridStyle.None;

            TagTableView.DataSource = new EditTagTableDataSource(TagsList, this);
            TagTableView.Delegate   = new EditTagTableDelegate(TagsList, this);
            TagTableView.ReloadData();

            var attributedTitle = Utility.AttributeTitle("Done", NSColor.Red, 13);

            DoneButton.AttributedTitle = attributedTitle;
            var alterTitle = Utility.AttributeTitle("Done", NSColor.Red, 13);

            DoneButton.AttributedAlternateTitle = alterTitle;

            string[] typeArray = { "NSStringPboardType" };
            TagTableView.RegisterForDraggedTypes(typeArray);

            this.CurrentTagIndex = -1;
        }
Esempio n. 4
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();
        }
 public void RemoveTagAtRow(int row)
 {
     AnnCategoryTagUtil.Instance.DeleteTag(TagsList[row].TagId);
     TagsList.RemoveAt(row);
     TagTableView.ReloadData();
 }