Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
                }
            }
        }