public override void ViewDidLoad()
        {
            ReloadTagsData();

            TagsTableView.UsesAlternatingRowBackgroundColors = false;
            TagsTableView.SelectionHighlightStyle            = NSTableViewSelectionHighlightStyle.Regular;
            TagsTableView.GridStyleMask = NSTableViewGridStyle.None;
            TagsTableView.EnclosingScrollView.BorderType = NSBorderType.BezelBorder;

            TagsTableView.DataSource = new AHLTagsTableDataSource(TagsList);
            TagsTableView.Delegate   = new AHLTagsTableDelegate(TagsList, this);
            TagsTableView.ReloadData();

            var attributedTitle = Utility.AttributeTitle("Delete", NSColor.Red, 12);

            DelNoteButton.AttributedTitle = attributedTitle;
            var alterTitle = Utility.AttributeTitle("Delete", NSColor.DarkGray, 12);

            DelNoteButton.AttributedAlternateTitle = alterTitle;

            attributedTitle = Utility.AttributeTitle("Add Note", NSColor.Red, 12);
            AddNoteButton.AttributedTitle = attributedTitle;
            alterTitle = Utility.AttributeTitle("Add Note", NSColor.DarkGray, 12);
            AddNoteButton.AttributedAlternateTitle = alterTitle;

            attributedTitle            = Utility.AttributeTitle("Edit", NSColor.Red, 12);
            EditButton.AttributedTitle = attributedTitle;
            alterTitle = Utility.AttributeTitle("Edit", NSColor.Red, 12);
            EditButton.AttributedAlternateTitle = alterTitle;
        }
        public void ReloadTagsData()
        {
            List <ColorTagState> backupTags = null;

            if (TagsList == null)
            {
                TagsList = new List <ColorTagState> ();
            }
            else
            {
                backupTags = new List <ColorTagState> ();
                backupTags.AddRange(TagsList);
                TagsList.Clear();
            }

            if (AnnCategoryTagUtil.Instance == null)
            {
                return;
            }

            var tagList     = AnnCategoryTagUtil.Instance.GetTags();
            var tempTagList = new List <AnnotationTag> ();

            tempTagList.AddRange(tagList);

            if (tagList != null)
            {
                foreach (var tag in tempTagList)
                {
                    var colorTag = new ColorTagState();
                    colorTag.CheckState = NSCellStateValue.Off;
                    if (backupTags != null)
                    {
                        for (int i = 0; i < backupTags.Count; i++)
                        {
                            if (tag.TagId == backupTags [i].Tag.TagId)
                            {
                                colorTag.CheckState = backupTags [i].CheckState;
                                break;
                            }
                        }
                    }

                    colorTag.Tag = tag;
                    TagsList.Add(colorTag);
                }
            }

            if (backupTags != null)
            {
                backupTags.Clear();
                backupTags = null;
            }

            if (TagsTableView != null)
            {
                TagsTableView.ReloadData();
            }
        }
        public override void ViewDidLoad()
        {
            ReloadTagsData();

            TagsTableView.UsesAlternatingRowBackgroundColors = false;
            TagsTableView.SelectionHighlightStyle            = NSTableViewSelectionHighlightStyle.Regular;
            TagsTableView.GridStyleMask = NSTableViewGridStyle.None;
            TagsTableView.EnclosingScrollView.BorderType = NSBorderType.BezelBorder;

            TagsTableView.DataSource = new AHLTagsTableDataSource(TagsList);
            TagsTableView.Delegate   = new AHLTagsTableDelegate(TagsList, this);
            TagsTableView.ReloadData();

            var attributedTitle = Utility.AttributeTitle("Delete", NSColor.Red, 12);

            DelNoteButton.AttributedTitle = attributedTitle;
            var alterTitle = Utility.AttributeTitle("Delete", NSColor.DarkGray, 12);

            DelNoteButton.AttributedAlternateTitle = alterTitle;


            attributedTitle            = Utility.AttributeTitle("Edit", NSColor.Red, 12);
            EditButton.AttributedTitle = attributedTitle;
            alterTitle = Utility.AttributeTitle("Edit", NSColor.Red, 12);
            EditButton.AttributedAlternateTitle = alterTitle;

            attributedTitle            = Utility.AttributeTitle("Note", NSColor.Brown, 12);
            NoteButton.AttributedTitle = attributedTitle;
            alterTitle = Utility.AttributeTitle("Note", NSColor.DarkGray, 12);
            NoteButton.AttributedAlternateTitle = alterTitle;

            attributedTitle = Utility.AttributeTitle("Delete Annotation", NSColor.Brown, 12);
            DelAnnotationBtn.AttributedTitle = attributedTitle;
            alterTitle = Utility.AttributeTitle("Delete Annotation", NSColor.DarkGray, 12);
            DelAnnotationBtn.AttributedAlternateTitle = alterTitle;

            NoteBkgView.WantsLayer            = true;
            NoteBkgView.Layer.BackgroundColor = Utility.ColorWithRGB(253, 251, 176, 1.0f).CGColor;

            HSeprator.WantsLayer            = true;
            HSeprator.Layer.BackgroundColor = NSColor.Grid.CGColor;

            VSeprator.WantsLayer            = true;
            VSeprator.Layer.BackgroundColor = NSColor.Grid.CGColor;

            NoteTextView.BackgroundColor = Utility.ColorWithRGB(253, 251, 176, 1.0f);
        }
示例#4
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();
            }
        }