// Insert an item above the currently selected one. The current selection is maintained. private void btnInsert_Click(object sender, EventArgs e) { DlgSequenceItem dlg = new DlgSequenceItem(); if (dlg.ShowDialog() == DialogResult.Cancel) { return; } lstSequence.Items.Insert(lstSequence.SelectedIndex, dlg.SelectedTask.Description); SetEnabledStates(); }
// Add a new task to the list at the end of the sequence. Select the new item private void btnAdd_Click(object sender, EventArgs e) { DlgSequenceItem dlg = new DlgSequenceItem(); if (dlg.ShowDialog() == DialogResult.Cancel) { return; } lstSequence.SelectedIndex = lstSequence.Items.Add(dlg.SelectedTask.Description); SetEnabledStates(); }