private void EditProduct(object sender, RoutedEventArgs e) { Button button = e.Source as Button; Product product = button.CommandParameter as Product; EditProductWindow editProductWindow = new EditProductWindow(product); if (editProductWindow.ShowDialog() == true) { viewModel.EditProduct(editProductWindow.Product); } }
private void EditProductFromList(object sender, MouseButtonEventArgs e) { ListBox list = e.Source as ListBox; Product product = list.SelectedItem as Product; if (product != null) { EditProductWindow editProductWindow = new EditProductWindow(product); if (editProductWindow.ShowDialog() == true) { viewModel.EditProduct(editProductWindow.Product); } } }
private void EditProduct(object sender, RoutedEventArgs e) { Button button = e.Source as Button; Product product = button.CommandParameter as Product; Product editableProduct = new Product(product.Id, product.Name, product.Barcode, product.HasExpirationDate, product.HasConsignmentPrice, product.Price, product.Consignments); EditProductWindow editProductWindow = new EditProductWindow(editableProduct); if (editProductWindow.ShowDialog() == true) { viewModel.EditProduct(editProductWindow.Product); } }
protected void HandleDoubleClick(object sender, MouseButtonEventArgs e) { var product = ((ListBoxItem)sender).Content as Product; if (product != null) { Product editableProduct = new Product(product.Id, product.Name, product.Barcode, product.HasExpirationDate, product.HasConsignmentPrice, product.Price, product.Consignments); EditProductWindow editProductWindow = new EditProductWindow(editableProduct); if (editProductWindow.ShowDialog() == true) { viewModel.EditProduct(editProductWindow.Product); } } }