コード例 #1
0
 private void publisherEditBtnClick(object sender, RoutedEventArgs e)
 {
     publisher selected = (publisher)publisherDataGrid.SelectedItem;
     PublisherWindow pw = new PublisherWindow(selected.pub_id);
     pw.ShowDialog();
     try
     {
         using (NET_MD2Entities context = new NET_MD2Entities())
         {
             publisherDataGrid.ItemsSource = context.publishers.ToList();
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show("Something went wrong! " + exc.Message);
     }
 }
コード例 #2
0
 private void publisherAddBtnClick(object sender, RoutedEventArgs e)
 {
     PublisherWindow pw = new PublisherWindow();
     pw.ShowDialog();
     try
     {
         using (NET_MD2Entities context = new NET_MD2Entities())
         {
             publisherDataGrid.ItemsSource = context.publishers.ToList(); //This seems like a performance hazard, since I'm reloading the whole table after every edit.
             //But, as far as I know, that's the proper way to do it.
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show("Something went wrong! " + exc.Message);
     }
 }