Example #1
0
        private void RebuildTagToolStrip()
        {
            GameFileViewControl currentControl = GetCurrentViewControl();

            if (currentControl != null)
            {
                List <ITagData> addTags    = new List <ITagData>();
                List <ITagData> removeTags = new List <ITagData>();

                Tags = DataSourceAdapter.GetTags().OrderBy(x => x.Name).ToArray();

                foreach (var gameFile in SelectedItems(currentControl))
                {
                    if (gameFile.GameFileID.HasValue)
                    {
                        var gameFileTags      = TagMapLookup.GetTags(gameFile);
                        var currentRemoveTags = Tags.Where(x => gameFileTags.Any(y => y.TagID == x.TagID));
                        var currentAddTags    = Tags.Except(currentRemoveTags);

                        addTags    = addTags.Union(currentAddTags).ToList();
                        removeTags = removeTags.Union(currentRemoveTags).ToList();
                    }
                }

                ToolStripMenuItem tagToolStrip       = mnuLocal.Items.Cast <ToolStripItem>().FirstOrDefault(x => x.Text == "Tag") as ToolStripMenuItem;
                ToolStripMenuItem removeTagToolStrip = mnuLocal.Items.Cast <ToolStripItem>().FirstOrDefault(x => x.Text == "Remove Tag") as ToolStripMenuItem;

                if (tagToolStrip != null)
                {
                    BuildTagToolStrip(tagToolStrip, addTags, tagToolStripItem_Click);
                    BuildTagToolStrip(removeTagToolStrip, removeTags, removeTagToolStripItem_Click);
                }
            }
        }
Example #2
0
        public void UpdateTags()
        {
            if (Tags != null)
            {
                PreviousTags = Tags.ToArray();
            }

            Tags = DataSourceAdapter.GetTags().OrderBy(x => x.Name).ToArray();
            if (PreviousTags == null)
            {
                PreviousTags = Tags;
            }
        }
        private List <ITabView> CreateTagTabs(ColumnField[] columnTextFields, ColumnConfig[] colConfig)
        {
            List <ITabView>        ret  = new List <ITabView>();
            IEnumerable <ITagData> tags = DataSourceAdapter.GetTags().Where(x => x.HasTab).OrderBy(x => x.Name);

            Tags = tags.ToArray();

            foreach (ITagData tag in tags)
            {
                ret.Add(CreateTagTab(columnTextFields, colConfig, tag.Name, tag, false));
            }

            return(ret);
        }
Example #4
0
        public void UpdateTags()
        {
            if (Tags != null)
            {
                PreviousTags = Tags.ToArray();
            }

            Tags = SortTags(DataSourceAdapter.GetTags()).ToArray();
            if (PreviousTags == null)
            {
                PreviousTags = Tags;
            }

            TagsChanged?.Invoke(this, EventArgs.Empty);
        }
        private void RebuildTagToolStrip()
        {
            IEnumerable <ITagData> tags = DataSourceAdapter.GetTags().OrderBy(x => x.Name);

            Tags = tags.ToArray();

            ToolStripMenuItem tagToolStrip       = mnuLocal.Items.Cast <ToolStripItem>().FirstOrDefault(x => x.Text == "Tag") as ToolStripMenuItem;
            ToolStripMenuItem removeTagToolStrip = mnuLocal.Items.Cast <ToolStripItem>().FirstOrDefault(x => x.Text == "Remove Tag") as ToolStripMenuItem;

            if (tagToolStrip != null)
            {
                BuildTagToolStrip(tagToolStrip, tags, tagToolStripItem_Click);
                BuildTagToolStrip(removeTagToolStrip, tags, removeTagToolStripItem_Click);
            }
        }