private void btnAdd_Click(object sender, RoutedEventArgs e) { AddEditBookWin addEditBookWin = new AddEditBookWin(); this.Opacity = 0.5; addEditBookWin.ShowDialog(); ListBook.ItemsSource = AppData.context.Book.ToList(); this.Opacity = 1; }
private void btnChange_Click(object sender, RoutedEventArgs e) { if (ListBook.SelectedItem is Book selectbook) { AddEditBookWin addEditBookWin = new AddEditBookWin(selectbook); this.Opacity = 0.5; addEditBookWin.ShowDialog(); ListBook.ItemsSource = AppData.context.Book.ToList(); this.Opacity = 1; } else { MessageBox.Show("Запись не выбрана", "Внимание", MessageBoxButton.OK, MessageBoxImage.Information); } }