Beispiel #1
0
        void testDeleteTag()
        {
            ITag tag = new UndoableTag("Flag", false);

              IFilter filterRed = new BasicFilter("Red Flag", tag, StringContaining.getInstance(), "red");
              IFilter filterYellow = new BasicFilter("Yellow Flag", tag, StringContaining.getInstance(), "yellow");
              IFilter filterRedOrYello = new CombinedFilter_OR("Red or Yellow", filterRed, filterYellow);

              Data.insertTag(tag);
              Data.insertFilter(filterRed);
              Data.insertFilter(filterYellow);
              Data.insertFilter(filterRedOrYello);

              int i = 0;
              foreach (IEmail email in Data.getEmailCollection())
              {
            string value = i % 2 == 0 ? "yellow" : "red";
            tag.tagEmail(email, value);
            i++;
            if (i == 10) break;
              }

              System.Windows.Forms.MessageBox.Show(Data.getFilterCollection().Count.ToString());
              Data.removeTag(tag);
              System.Windows.Forms.MessageBox.Show(Data.getFilterCollection().Count.ToString());
        }
Beispiel #2
0
        //tag to selected email
        private void btnAddTag_Click(object sender, EventArgs e)
        {
            //if user selects existing tag
              if (lsTags.SelectedItem != null)
              {
            ITag selected_tag = ((TagBriefInfoForCmb)lsTags.SelectedItem).getTag();

            try //try add tag
            {
              selected_tag.tagEmail(selected_email, txtNewTagValue.Text);
            }
            catch //tag exist --> edit
            {
              selected_tag.editEmailTag(selected_email, txtNewTagValue.Text);
            }
              }
              else //user type new tag type, create tag and add tag to email
              {
            string new_tag_name = lsTags.Text;
            ITag new_tag = new UndoableTag(new_tag_name, false);
            Data.insertTag(new_tag);
            new_tag.tagEmail(selected_email, txtNewTagValue.Text);
              }

              updateMainScreen();
        }