Ejemplo n.º 1
0
 private void editButton_Click(object sender, RoutedEventArgs e)
 {
     using (SgDbContext sbc = new SgDbContext())
     {
         if (resultGrid.ItemsSource.GetType() == typeof(ObservableCollection <Sage>))
         {
             Sage           selectedSage  = resultGrid.SelectedItem as Sage;
             SageItemWindow addSageDialog = new SageItemWindow(buttonText: "Edit", sageDefaultName: selectedSage.Name, sageCityDefault: selectedSage.City, sageAgeDefault: selectedSage.Age.ToString(), isNewItem: false, sageId: selectedSage.Id);
             _ = addSageDialog.ShowDialog();
         }
         else if (resultGrid.ItemsSource.GetType() == typeof(ObservableCollection <Book>))
         {
             Book           selectedBook   = resultGrid.SelectedItem as Book;
             BookItemWindow bookItemWindow = new BookItemWindow(buttonText: "Edit Book", bookName: selectedBook.Title, bookDescription: selectedBook.Description, isNewItem: false, bookId: selectedBook.Id);
             _ = bookItemWindow.ShowDialog();
         }
     }
 }
Ejemplo n.º 2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            BookItemWindow addBookWindowDialog = new BookItemWindow();

            _ = addBookWindowDialog.ShowDialog();
        }