private void btnEdit_Click(object sender, RoutedEventArgs e) { try { if (this.dgvVendors.SelectedCells.Count < 1) { MessageBox.Show("请选择厂家"); return; } var item = this.dgvVendors.SelectedCells[0].Item as ShopErp.Domain.Vendor; if (item == null) { MessageBox.Show("请选择厂家"); return; } ICloneable cItem = item as ICloneable; var window = new VendorEditWindow { Vendor = (cItem.Clone() as ShopErp.Domain.Vendor) }; window.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { var window = new VendorEditWindow(); window.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }