private void BtnEdit_Click(object sender, RoutedEventArgs e) { int pos = DataGrid.SelectedIndex; if (pos == -1) { MessageBox.Show("Seleccione un avituallamiento", "Error"); return; } Supply supply; try { supply = (Supply)DataGrid.SelectedItem; } catch (InvalidCastException) { return; } SupplyForm window = new SupplyForm(supply.DeepClone(), pos); window.ShowDialog(); }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { SupplyForm window = new SupplyForm(); window.ShowDialog(); }