// Either a pending or completed course is complete, but not both. // Update the selected one with the name returned from the dialog. private void CourseEdited(object sender, AddedEditedCourse e) { int index = -1; if (lstPending.SelectedIndex != -1) { index = lstPending.SelectedIndex; lstPending.Items.RemoveAt(index); lstPending.Items.Insert(index, e.Name); } else { index = lstComplete.SelectedIndex; lstComplete.Items.RemoveAt(index); lstComplete.Items.Insert(index, e.Name); } }
// Add the received course to courses pending completion. These // can be moved to completed via the swap button. private void CourseAdded(object sender, AddedEditedCourse e) { lstPending.Items.Add(e.Name); }