Ejemplo n.º 1
0
        public TagFilter(List <catItem> globalCIList, List <string> globalCatList, List <catItem> restoreInclude, List <catItem> restoreExclude, INIFile langIni)
        {
            InitializeComponent();

            foreach (catItem cI in globalCIList)
            {
                globalCatItems.Add(cI);
            }

            foreach (string s in globalCatList)
            {
                globalCats.Add(s);
            }

            allTags.Nodes.AddRange(FillTree.generateNodes(globalCatItems, globalCats));
            allTags.ExpandAll();

            //restore existing tag filter and get unique cat list from restored filters
            foreach (catItem cI in restoreInclude)
            {
                includeList.Add(cI);
                if (!includeCats.Contains(cI.cat))
                {
                    includeCats.Add(cI.cat);
                }
            }
            foreach (catItem cI in restoreExclude)
            {
                excludeList.Add(cI);
                if (!excludeCats.Contains(cI.cat))
                {
                    excludeCats.Add(cI.cat);
                }
            }
            addToList(includeList, tvInclude, includeCats);
            addToList(excludeList, tvExclude, excludeCats);

            //Set interface text
            if (langIni != null)
            {
                string secTagFilter = "TagFilterWindow";
                Text = langIni.IniReadValue(secTagFilter, "WindowTitle");
                lblAvailTags.Text = langIni.IniReadValue(secTagFilter, "AvailTags");
                lblInc.Text       = langIni.IniReadValue(secTagFilter, "IncludeTags");
                lblExc.Text       = langIni.IniReadValue(secTagFilter, "ExcludeTags");
                btnInclude.Text   = langIni.IniReadValue(secTagFilter, "IncludeBtn");
                btnExclude.Text   = langIni.IniReadValue(secTagFilter, "ExcludeBtn");
                btnRemove.Text    = langIni.IniReadValue(secTagFilter, "RemoveTag");
                btnRemoveAll.Text = langIni.IniReadValue(secTagFilter, "RemoveAll");
                btnOK.Text        = langIni.IniReadValue(secTagFilter, "OK");
                btnCancel.Text    = langIni.IniReadValue(secTagFilter, "Cancel");
                removeAllMessage  = langIni.IniReadValue(secTagFilter, "RemoveAllMsg");
                removeAllMsgTitle = langIni.IniReadValue(secTagFilter, "RemoveAllMsgTitle");
                miscTagCat        = langIni.IniReadValue("Tags", "MiscTagName");
            }
        }
Ejemplo n.º 2
0
        public AddExistingTag(string windowTitle, string okButtonText, string cancButtonText,
                              List <catItem> globalTags, List <string> globalCats)
        {
            InitializeComponent();
            this.Text      = windowTitle;
            btnOK.Text     = okButtonText;
            btnCancel.Text = cancButtonText;

            TreeNode[] allTags = FillTree.generateNodes(globalTags, globalCats);
            tvGlobalTags.Nodes.AddRange(allTags);
            tvGlobalTags.ExpandAll();
        }
Ejemplo n.º 3
0
        private void removeFromList()
        {
            TreeView       tv;
            List <catItem> lst;
            List <string>  cats;

            if (currentTree == "tvInclude")
            {
                tv   = tvInclude;
                lst  = includeList;
                cats = includeCats;
            }
            else
            {
                tv   = tvExclude;
                lst  = excludeList;
                cats = excludeCats;
            }

            TreeNode selNode = tv.SelectedNode;

            if (selNode != null)
            {
                //List<string> remainingCats = new List<string>();
                catItem cI = new catItem();
                if (selNode.Parent != null)
                {
                    cI.cat  = selNode.Parent.Text;
                    cI.item = selNode.Text;
                }
                lst.Remove(cI);

                //Get a list of categories that remain after the catItem was removed
                cats.Clear();
                foreach (catItem rmCatItem in lst)
                {
                    if (!cats.Contains(rmCatItem.cat))
                    {
                        cats.Add(rmCatItem.cat);
                    }
                }
                addNodesToTree(tv, FillTree.generateNodes(lst, cats));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds a tag from available tags to include or exclude lists.
        /// </summary>
        /// <param name="lst"></param>
        /// <param name="tv"></param>
        /// <param name="catList"></param>
        private void addToList(List <catItem> lst, TreeView tv, List <string> catList)
        {
            TreeNode selNode    = allTags.SelectedNode;
            catItem  selCatItem = new catItem();

            if (selNode != null && selNode.Parent != null)
            {
                selCatItem.cat  = selNode.Parent.Text;
                selCatItem.item = selNode.Text;
                if (!lst.Contains(selCatItem))
                {
                    lst.Add(selCatItem);
                    if (!catList.Contains(selCatItem.cat))
                    {
                        catList.Add(selCatItem.cat);
                    }
                }
            }
            addNodesToTree(tv, FillTree.generateNodes(lst, catList));
            allTags.SelectedNode = null;
        }