private void AddProduct() { EditProduct editProductDialog = new EditProduct(); if (editProductDialog.ShowDialog() == DialogResult.OK) { int index = _products.Count; _products.Add(new ProductWrapper( _products.Count, editProductDialog.Product, editProductDialog.Description)); PopulateForm(); } }
private void EditProduct() { if (lV_products.SelectedItems.Count > 0) { if (lV_products.SelectedItems[0].Tag is ProductWrapper) { ProductWrapper product = (lV_products.SelectedItems[0].Tag as ProductWrapper); EditProduct editProductDialog = new EditProduct(product.Product, product.Description); if (editProductDialog.ShowDialog() == DialogResult.OK) { _products.Remove(product); ProductWrapper newProduct = new ProductWrapper( _products.Count, editProductDialog.Product, editProductDialog.Description); _products.Add(newProduct); PopulateForm(); } } } }