Beispiel #1
0
        public void TagButton_Remove(object sender, EventArgs e)
        {
            string tagName = TaggingTools.GetButtonTagName(activeButton);

            // Get the tag
            TagData tag = null;

            foreach (string category in tagButtons.Keys)
            {
                foreach (Tuple <string, Button> tagTuple in tagButtons[category])
                {
                    if (activeButton == tagTuple.Item2)
                    {
                        tag = WallpaperData.TaggingInfo.GetTag(category, tagTuple.Item1);
                        break;
                    }
                }
            }

            if (tag != null)
            {
                // Determine if a child tag of this tag is present in the image, if so then the tag cannot be removed
                if (activeImage.CheckIfTagIsParent(tag, out var childTagName))
                {
                    MessageBox.Show("You cannot remove the tag " + tag.Name + " while it's child tag " + childTagName + " is also tagged");
                    return;
                }

                activeImage.RemoveTag(tag);

                // remove tagbutton
                tagNames.Remove(tag.Name);
                tagButtons[tag.ParentCategoryName].Remove(new Tuple <string, Button>(tag.Name, activeButton));
                imageTagsFLP.Controls.RemoveAt(imageTagsFLP.Controls.IndexOf(activeButton));
                activeButton.Dispose();
            }
            else
            {
                MessageBox.Show("Error: Tag " + tagName + " was not found");
            }
        }
Beispiel #2
0
        public void TagButton_ToggleTagNamingException(object sender, EventArgs e)
        {
            bool givenException = activeImage.ToggleTagNamingException(TaggingTools.GetButtonTagName(activeButton));

            activeButton.ForeColor = givenException ? Color.Red : Color.Black;
        }