void listDiseases_MouseDoubleClick(object sender, MouseButtonEventArgs e) { Disease d = Diseases.ElementAt(listDiseases.SelectedIndex); DiseaseObjectEditor window = new DiseaseObjectEditor(d); window.Closed += async delegate { await d.SaveAsync(); }; window.ShowDialog(); }
private void btnDiseaseEdit_Click(object sender, RoutedEventArgs e) { if (listDiseases.SelectedIndex != -1) { int index = listDiseases.SelectedIndex; DiseaseObjectEditor window = new DiseaseObjectEditor(Diseases.ElementAt(index)); window.Closed += delegate { Diseases.ElementAt(index).SaveAsync(); }; window.ShowDialog(); } }
private void buttonDiseaseAdd_Click(object sender, RoutedEventArgs e) { Disease d = new Disease() { DiseaseId = GetFirstAvailableDiseaseID(), PictureId = -1 }; Diseases.Add(d); Console.WriteLine("Disease ID: " + d.DiseaseId); DiseaseObjectEditor editor = new DiseaseObjectEditor(d); editor.Closed += delegate { d.SaveAsync(); }; editor.ShowDialog(); }