Exemplo n.º 1
0
 /// <summary>
 /// Adds the drink to the order list.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void AddDrink_Click(object sender, RoutedEventArgs e)
 {
     if (currentDrink != null)
     {
         float  price;
         string withIce = currentDrink.Ice ? "(Ice)" : "";
         drinkNames.Add(currentDrink.GetName + " (" + currentDrink.Size + ") " + withIce);
         price = currentDrink.GetPrice;
         allDrinks.Add(currentDrink);
         DisplayOrderList();
         DisplayFinalPrice();
         currentDrink    = null;
         DrinkPrice.Text = "0 kr";
         ResetDrinkIndexes();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Sets the drink.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Drink_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (Drink.SelectedIndex == 0)
     {
         currentDrink    = null;
         DrinkPrice.Text = "0 kr";
         Ice.IsChecked   = false;
     }
     else
     {
         sizeDrink = DrinkSize.SelectedValue.ToString();
         string drinkString = Drink.SelectedValue.ToString();
         drink.TryGetValue(drinkString, out float value);
         currentDrink = new DrinkPolymorth(DrinkPrice, drinkString, 0, sizeDrink, value, 5);
         sizePriceDrink.TryGetValue(sizeDrink, out value);
         currentDrink.SetSizePrice = value;
         currentDrink.Ice          = (bool)Ice.IsChecked;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Resests list of added pizzas, drinks, indexes, and values regarding the textboxes, and the textboxes themselves.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Order_Click(object sender, RoutedEventArgs e)
 {
     TotalPriceBox.Text = "0 kr";
     allDrinks.Clear();
     allPizza.Clear();
     pizzaNames.Clear();
     drinkNames.Clear();
     PizzaListBox.Text = "";
     if (currentDrink != null)
     {
         currentDrink = null;
     }
     if (currentPizza != null)
     {
         currentPizza = null;
     }
     ResetDrinkIndexes();
     ResetIndexes();
     PizzaType.SelectedIndex = 0;
     discount = false;
     mostExpensiveDough_Name  = null;
     mostExpensiveDough_Price = null;
     finalPrice = 0;
 }