예제 #1
0
        private void clearTagsFolder_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(DeleteFolderTagTextBox.Text))
            {
                GlobalStatics.currentTagsFolder.Clear();
                AddFolderCurrentTagTextBox.Clear();
            }
            //Allow to delete specific tags when typed in the text box.
            else
            {
                string Tag;
                Tag = DeleteFolderTagTextBox.Text;

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