private void btnCopyActivity_Click(object sender, EventArgs e) { if (olvActivities.SelectedObjects.Count == 1) { Activity selectedActivity = (Activity)olvActivities.SelectedObject; if (selectedActivity is Job job) { using (AddJob addJob = new AddJob(subjects, job)) { if (addJob.ShowDialog() == DialogResult.OK) { activities.Add(addJob.GetResult()); _madeChanges = true; } } ShowEvents(); } if (selectedActivity is Lesson lesson) { using (AddLesson addLesson = new AddLesson(subjects, lesson)) { if (addLesson.ShowDialog() == DialogResult.OK) { activities.Add(addLesson.GetResult()); _madeChanges = true; } } ShowEvents(); } } }
private void btnAddLesson_Click(object sender, EventArgs e) { using (AddLesson addLesson = new AddLesson(subjects)) { if (addLesson.ShowDialog() == DialogResult.OK) { activities.Add(addLesson.GetResult()); _madeChanges = true; } } ShowEvents(); }