Exemple #1
0
        private void renameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView3.SelectedItems.Count == 0)
            {
                return;
            }
            var tag = (listView3.SelectedItems[0].Tag as Tag);

            TagEditDialog ted = new TagEditDialog();

            ted.Set(tag.Name);
            ted.ShowDialog();

            if (tags.Any(z => z.Name == ted.Value))
            {
                MessageBox.Show("duplicate tag.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            tag.Name = ted.Value;
            updateTagsList();
        }
Exemple #2
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TagEditDialog ted = new TagEditDialog();

            ted.Set("tag1");
            if (ted.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (tags.Any(z => z.Name == ted.Value))
            {
                MessageBox.Show("duplicate tag.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            tags.Add(new Tag()
            {
                Name = ted.Value
            });
            updateTagsList();
        }