private void BtnEdit_Click(object sender, RoutedEventArgs e) { if (lbxCds.SelectedItem is Cd cdToEdit) { EditCdWindow editCdWindow = new EditCdWindow(cdToEdit); editCdWindow.ShowDialog(); Repository repo = Repository.GetInstance(); _cds = repo.GetAllCds(); lbxCds.ItemsSource = _cds; } else { MessageBox.Show("Keine CD ausgewählt!"); } }
private void BtnEdit_Clicked(object sender, RoutedEventArgs e) { rep = Repository.GetInstance(); Cd selectedCd = (Cd)lbxCds.SelectedItem; if (selectedCd != null) { EditCdWindow editCdWindow = new EditCdWindow(selectedCd); editCdWindow.ShowDialog(); } else { MessageBox.Show("Wählen Sie eine CD zum Bearbeiten"); } _cds = rep.GetAllCds(); lbxCds.ItemsSource = _cds; }