Ejemplo n.º 1
0
        private void AddButton_OnClick(object sender, RoutedEventArgs e)
        {
            var window = new ProductWindow();

            if (window.ShowDialog() == false)
            {
                return;
            }

            AddProduct(window.ResultProduct);
            _products.Add(window.ResultProduct);
        }
Ejemplo n.º 2
0
        private void EditButton_OnClick(object sender, RoutedEventArgs e)
        {
            var editingProduct = (Product)ProductsDataGrid.SelectedItem;
            var window         = new ProductWindow(editingProduct);

            if (window.ShowDialog() == false)
            {
                return;
            }

            UpdateProduct(window.ResultProduct);
            _products[_products.IndexOf(editingProduct)] = window.ResultProduct;
        }