private void button3_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count != 0) { foreach (int index in listView1.SelectedIndices) { listView1.Items.RemoveAt(index); } TagsetUpdateEventArgs args = new TagsetUpdateEventArgs(); args.Name = comboBox1.SelectedItem.ToString(); args.Type = 0; args.Tag = listView1.SelectedItems[0].Text; listView1.SelectedItems.Clear(); UpdateTagset?.Invoke(this, args); } }
private void button1_Click(object sender, EventArgs e) { var item = new ListViewItem(textBox1.Text); if (!String.IsNullOrEmpty(textBox1.Text) && !listView1.Items.Contains(item)) { listView1.Items.Add(item); TagsetUpdateEventArgs args = new TagsetUpdateEventArgs(); args.Name = comboBox1.SelectedItem.ToString(); args.Tag = textBox1.Text; args.Type = 1; UpdateTagset?.Invoke(this, args); } else { MessageBox.Show("Write your tag in the box below"); } }