private void NewTask_Click(object sender, RoutedEventArgs e) { EditDialog newDialog = new EditDialog(new TaskType()); newDialog.Owner = this; //For centering on parent if (newDialog.ShowDialog() == true) { taskList.Add(newDialog.currentTask); } }
private void EditTask_Click(object sender, RoutedEventArgs e) { if (taskListBox.SelectedItem != null) { int currentIndex = taskListBox.SelectedIndex; EditDialog newDialog = new EditDialog(taskList[currentIndex].ShallowCopy()); newDialog.Owner = this; //For centering on parent if (newDialog.ShowDialog() == true) { taskList[currentIndex] = newDialog.currentTask; } } }