using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; 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 T2Currency { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { float kurssi; public MainWindow() { InitializeComponent(); LataaValuutat(); } private void LataaValuutat() { //List valuutat = new List() { "USD", "SEK", "GBP" }; cmbValuutat.ItemsSource = JAMK.IT.CurrencyManager.GetCurrencies(); cmbValuutat.SelectedIndex = 0; } private void LaskeEurot() { float luku; if (txtValuutta.Text.Length > 0 & txtValuutta.Text != "0" & float.TryParse(txtValuutta.Text, out luku)) { txtMaksan.Text = (luku * kurssi).ToString("0.00"); } } private void cmbValuutat_SelectionChanged(object sender, SelectionChangedEventArgs e) { kurssi = (float)cmbValuutat.SelectedValue; //MessageBox.Show(kurssi.ToString()); LaskeEurot(); } private void txtValuutta_TextChanged(object sender, TextChangedEventArgs e) { if (txtValuutta.Text.Length > 0) LaskeEurot(); } } }