Example #1
0
        public async Task ChangeLocal(string local)
        {
            try
            {
                await semaphoreSlim.WaitAsync();

                _configuration.CurrentLocal = local;

                if (_configuration.ForceReloadLocal || !_values.ContainsKey(local))
                {
                    _currentValues = await _valueProvider.FetchValues(local);

                    _values[local] = _currentValues;
                }
                else
                {
                    _currentValues = _values[local];
                }
            }
            catch (Exception)
            {
                _logger.LogError("Unable to get values.");
            }
            finally
            {
                semaphoreSlim.Release();
            }

            OnLocalUpdateOrChange.Invoke();
        }