示例#1
0
        private void clearTagsSingleButton_Click(object sender, EventArgs e)
        {
            //When clicking "Clear Tags" it will delete everything in current tags if nothing was in the text
            if (String.IsNullOrEmpty(AddImageDeleteTagTextBox.Text))
            {
                GlobalStatics.currentTagsSingle.Clear();
                AddImageCurrentTagTexBox.Clear();
            }
            //Allow to delete specific tags when typed in the text box.
            else
            {
                string Tag;
                Tag = AddImageDeleteTagTextBox.Text;

                //Iterate through the list and if the word is found then remove it from the list
                for (int i = 0; i < GlobalStatics.currentTagsSingle.Count; i++)
                {
                    if (Tag == GlobalStatics.currentTagsSingle[i])
                    {
                        GlobalStatics.currentTagsSingle.RemoveAt(i);
                    }
                }
                //Clears the current tags textbox and then print all the elements in the list
                // into the current tags textbox.
                AddImageCurrentTagTexBox.Clear();
                foreach (string var in GlobalStatics.currentTagsSingle)
                {
                    AddImageCurrentTagTexBox.AppendText(var);
                    AddImageCurrentTagTexBox.AppendText(", ");
                }
            }
            AddImageDeleteTagTextBox.Clear();
        }
示例#2
0
 private void AddImagesAddButton_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(AddImageAddTagTextBox.Text))
     {
         string Tag;
         Tag = AddImageAddTagTextBox.Text;
         AddImageAddTagTextBox.Clear();
         //add tag to List of tags if not already in, preventing duplicates
         if (!GlobalStatics.currentTagsSingle.Contains(Tag))
         {
             AddImageCurrentTagTexBox.AppendText(Tag);
             AddImageCurrentTagTexBox.AppendText(", ");
             GlobalStatics.currentTagsSingle.Add(Tag);
         }
     }
 }