示例#1
0
        private async Task LoadExchangeRatesAsync()
        {
            _timerLastStartTime = DateTime.UtcNow;
            try
            {
                var rates = await _exchangeRateRepository.GetCurrencyConversionRatesAsync();

                if (rates == null)
                {
                    throw new ExchangeRateNotFoundException("No content from Dunamo DB");
                }

                var currentSlot = GetCurrentSlot();
                _exchangeRates[currentSlot] = new Dictionary <CurrencyPair, decimal>(rates);
                _previousSlot = _currentSlot;
                _currentSlot  = currentSlot;

                //Load supported currencies
                _supportedCurrencies = LoadSupportedCurrencies(_exchangeRates[currentSlot]);
            }
            catch (Exception ex)
            {
                if (_isFirstLoadSuccess == false)
                {
                    _exchangeRates = null;
                }

                Platform.Common.ExceptionPolicy.HandleException(ex, "logonly");
            }
        }