using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace _2024._10._18_Feladat2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Dictionary<string, Dictionary<string, double>> d = new Dictionary<string, Dictionary<string, double>>()
            {
                { "EUR", new Dictionary<string, double>{ { "EUR", 1 }, { "HUF", 400.15 }, { "USD", 1.09 } } },
                { "HUF", new Dictionary<string, double>{ { "EUR", 0.0025 }, { "HUF", 1 }, { "USD", 0.0027 } } },
                { "USD", new Dictionary<string, double>{ { "EUR", 0.92 }, { "HUF", 368.18 }, { "USD", 1 } } }
            };

            var fromSelectedItem = (ComboBoxItem)FromCurrency.SelectedItem;
            var toSelectedItem = (ComboBoxItem)ToCurrency.SelectedItem;
            
            if (fromSelectedItem != null && toSelectedItem != null && Mennyiseg.Text != "")
            {
                Kiiras.Content = $"Az eredmény: {toSelectedItem.Content.ToString()} {(Convert.ToInt32(Mennyiseg.Text) * d[fromSelectedItem.Content.ToString()][toSelectedItem.Content.ToString()]).ToString("#,0.##")}";
                Mennyiseg.Text = "";
                FromCurrency.SelectedItem = null;
                ToCurrency.SelectedItem = null;
            }
            else
            {
                Kiiras.Content = $"Nincs kiválasztva minden érték!";
            }
            
        }
    }
}