using System;
using System.Collections.Generic;
using System.Windows;

namespace TerminalKFC.Windows
{
    /// <summary>
    /// Логика взаимодействия для OrderWindow.xaml
    /// </summary>
    public partial class OrderWindow : Window
    {
        public List<string> list = new List<string>();
        public int sum = 0;
        public OrderWindow()
        {
            InitializeComponent();
        }
        void Update()
        {
            BuyButton.Content = $"Оплатить: {sum}руб";
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            sum = GetNewSum(sum, 150);
            list.Add("Шефбургер - 150р.");
            Update();
        }
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            sum = GetNewSum(sum, 175);
            list.Add("Шефбургер делюкс - 175р.");
            Update();
        }
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            sum = GetNewSum(sum, 100);
            list.Add("Шефбургер маленький - 100р.");
            Update();
        }
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            sum = GetNewSum(sum, 300);
            list.Add("Твистер большой - 300р.");
            Update();
        }
        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            sum = GetNewSum(sum, 70);
            list.Add("Твистер маленький - 70р.");
            Update();
        }
        private void Button_Click_6(object sender, RoutedEventArgs e)
        {
            sum = GetNewSum(sum, 175);
            list.Add("Твистер стандартный - 175р.");
            Update();
        }
        private void Button_Click_7(object sender, RoutedEventArgs e)
        {
            sum = GetNewSum(sum, 20);
            list.Add("Мороженое - 20р.");
            Update();
        }
        private void Button_Click_8(object sender, RoutedEventArgs e)
        {
            sum = GetNewSum(sum, 35);
            list.Add("Мороженое с шок. крошкой - 35р.");
            Update();
        }
        private void Button_Click_9(object sender, RoutedEventArgs e)
        {
            sum = GetNewSum(sum, 150);
            list.Add("Мороженое Mars - 150р.");
            Update();
        }
        public int GetNewSum(int sum, int price)
        {
            return (sum + price);
        }
        private void BuyButton_Click(object sender, RoutedEventArgs e)
        {
            ResultOrderWindow row = new ResultOrderWindow();
            row.BlockOfGoods.AppendText($"Ваш заказ:" + "\n");
            foreach (string elem in list)
            {
                row.BlockOfGoods.AppendText(elem + "\n");
            }
            row.BlockOfGoods.AppendText($"Сумма: {sum}");
            row.Show();
            this.Close();
        }
    }
}
