private void deleteThisLineToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to delete this line?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { UCSLine line = new UCSLine(); line.ID = lsvLocateInfo.SelectedItems[0].SubItems[0].Text; line.Text = lsvLocateInfo.SelectedItems[0].SubItems[1].Text; pendingChanges.Add(new Tuple <UCSLine, ChangeOperation>(line, ChangeOperation.Delete)); lsvLocateInfo.Items.Remove(lsvLocateInfo.SelectedItems[0]); deleteThisLineToolStripMenuItem.Enabled = false; } }
private void txtKey_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (lvi != null) { UCSLine line = new UCSLine(); line.ID = txtKey.Text; line.Text = txtLocalizedText.Text; pendingChanges.Add(new Tuple <UCSLine, ChangeOperation>(line, ChangeOperation.Edit)); lvi.Text = txtKey.Text; lvi.SubItems[1].Text = txtLocalizedText.Text; int index = lsvLocateInfo.Items.IndexOf(lvi); lsvLocateInfo.Items.RemoveAt(index); lsvLocateInfo.Items.Insert(index, lvi); txtKey.Text = ""; txtLocalizedText.Text = ""; } } }
public frmAddNewLine() { InitializeComponent(); line = new UCSLine(); }