Exemplo n.º 1
0
        private void getRatesBtn_Click(object sender, EventArgs e)
        {
            if (currencyMenu.SelectedItem.ToString() == "EUR")
            {
                result.Visible = true;

                BitCoinRates resultRates = GetRates();
                int          userCoins   = Int32.Parse(amountOfBtc.Text);
                float        currentRate = resultRates.bpi.EUR.rate_float;
                float        btcResult   = userCoins * currentRate;
                result.Text = $"{btcResult} {resultRates.bpi.EUR.code}";
            }
        }
Exemplo n.º 2
0
        private void GetRatesBtn_Click(object sender, EventArgs e)
        {
            if (CurrencyMenu.SelectedItem.ToString() == "EUR")
            {
                ResultLbl.Visible = true;
                Result.Visible    = true;

                BitCoinRates ResultRates = GetRates();
                int          userCoins   = Int32.Parse(AmountOfBts.Text);
                float        CurrentRate = ResultRates.bpi.EUR.rate_float;
                float        btcResult   = userCoins * CurrentRate;
                Result.Text = $"{btcResult} {ResultRates.bpi.EUR.code}";
            }

            if (CurrencyMenu.SelectedItem.ToString() == "USD")
            {
                ResultLbl.Visible = true;
                Result.Visible    = true;

                BitCoinRates ResultRates = GetRates();
                int          userCoins   = Int32.Parse(AmountOfBts.Text);
                float        CurrentRate = ResultRates.bpi.USD.rate_float;
                float        btcResult   = userCoins * CurrentRate;
                Result.Text = $"{btcResult} {ResultRates.bpi.USD.code}";
            }

            if (CurrencyMenu.SelectedItem.ToString() == "GBP")
            {
                ResultLbl.Visible = true;
                Result.Visible    = true;

                BitCoinRates ResultRates = GetRates();
                int          userCoins   = Int32.Parse(AmountOfBts.Text);
                float        CurrentRate = ResultRates.bpi.GBP.rate_float;
                float        btcResult   = userCoins * CurrentRate;
                Result.Text = $"{btcResult} {ResultRates.bpi.GBP.code}";
            }
        }
Exemplo n.º 3
0
        private void GetRatesBTN_Click(object sender, EventArgs e)
        {
            if (CurrencyMenu.SelectedItem.ToString() == "EUR")
            {
                resultLabel.Visible = true;
                Result.Visible      = true;

                BitCoinRates resultRates = GetRates();
                int          userCoins   = Int32.Parse(AmountOfBTC.Text); //the amount of user's bitcoins

                float currentRate = resultRates.bpi.EUR.rate_float;       //current bitcoin rate in EUR
                float btcResult   = userCoins * currentRate;
                Result.Text = $"{btcResult} {resultRates.bpi.EUR.rate_float} EUR";
            }
            if (CurrencyMenu.SelectedItem.ToString() == "USD")
            {
                resultLabel.Visible = true;
                Result.Visible      = true;

                BitCoinRates resultRates = GetRates();
                int          userCoins   = Int32.Parse(AmountOfBTC.Text);
                float        currentRate = resultRates.bpi.USD.rate_float;
                float        btcResult   = userCoins * currentRate;
                Result.Text = $"{btcResult} {resultRates.bpi.USD.rate_float} USD";
            }
            if (CurrencyMenu.SelectedItem.ToString() == "GBP")
            {
                resultLabel.Visible = true;
                Result.Visible      = true;

                BitCoinRates resultRates = GetRates();
                int          userCoins   = Int32.Parse(AmountOfBTC.Text);
                float        currentRate = resultRates.bpi.GBP.rate_float;
                float        btcResult   = userCoins * currentRate;
                Result.Text = $"{btcResult} {resultRates.bpi.GBP.rate_float} GBP";
            }
        }