예제 #1
0
        private void ButtonAddProduct_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var name = ComboBoxProducts.Text;

                var product = Products.GetProduct(name);
                product.Price    = double.Parse(TextBoxPrice.Text);
                product.Quantity = double.Parse(TextBoxQuantity.Text);
                product.Cost     = product.Price * product.Quantity;


                newDelivery.AddProduct(product);
                ResetFields();
                LabelCostOfProducts.Content = newDelivery.CostOfProducts;
            }
            catch (Exception exception)
            {
                MessageBox.Show("Sprawdź poprawność wprowadzonych danych.\nSzczegóły: " + exception.Message, "Błąd!");
            }
        }