private async void PrepareDataAsync()
        {
            IsDataLoading = true;

            Currency currency = null;

            try
            {
                currency = await _initializationFacade.GetData();
            }
            catch (Exception ex)
            {
                PopError(ex.Message);
            }

            if (currency == null)
            {
                IsDataLoading = false;
                return;
            }

            foreach (var item in currency.Rates)
            {
                CurrencyRates.Add(new Rate
                {
                    CurrencyName = item.Key,
                    CurrencyRate = item.Value
                });
            }

            CentralDate = currency.Date.ToString();

            IsDataLoading = false;
        }
Пример #2
0
        private async void LoadCurrencyRatesAsync()
        {
            CurrencyRates.Clear();
            var newCurrencyRates = await currencyRateRepository.GetCurrencyRates();

            if (newCurrencyRates != null)
            {
                foreach (var code in newCurrencyRates)
                {
                    CurrencyRates.Add(code);
                }

                SelectedRateFirst  = CurrencyRates[0];
                SelectedRateSecond = CurrencyRates[1];
            }
        }
Пример #3
0
 public void AddCurrencyConversion(Currency fromCountry, double value)
 {
     CurrencyRates.Add(fromCountry, value);
 }