private void FormRule_Load(object sender, EventArgs e) { FormRule formRule = new FormRule(); if (editMode == true) { formRule.Text = "Edit rule"; nfcButton1.Text = "Edit"; textName.Text = ruleName; textFind.Text = ruleFind; textReplace.Text = ruleReplace; } else { textName.Text = String.Empty; textFind.Text = String.Empty; textReplace.Text = String.Empty; } nfcButton1.Focus(); }
private void ButtonAdd_Click(object sender, EventArgs e) { formRule.ShowDialog(this); if (FormRule.boolAdd == true) { string[] input = FormRule.sendtext.Split(','); ListViewItem[] lvs = new ListViewItem[1]; lvs[0] = new ListViewItem(new string[] { input[0], input[1], input[2], }); listView1.Items.AddRange(lvs); FormRule.SetAdd2false(); } else { } }
private void ButtonEdit_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 1 && listView1.SelectedItems.Count > 0) { FormRule.editMode = true; FormRule.ruleName = listView1.SelectedItems[0].SubItems[0].Text; FormRule.ruleFind = listView1.SelectedItems[0].SubItems[1].Text; FormRule.ruleReplace = listView1.SelectedItems[0].SubItems[2].Text; formRule.ShowDialog(this); string[] input = FormRule.sendtext.Split(','); listView1.SelectedItems[0].SubItems[0].Text = input[0]; listView1.SelectedItems[0].SubItems[1].Text = input[1]; listView1.SelectedItems[0].SubItems[2].Text = input[2]; FormRule.editMode = false; FormRule.SetAdd2false(); } else if (listView1.SelectedItems.Count > 1) { MessageBox.Show("You can only select one rule to edit", "~~>_<~~", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { } }