Exemple #1
0
        private async Task LoadCacheFromStorage()
        {
            var data = await _databaseAdapter.GetAllStopPoints().ConfigureAwait(false);

            var istStopPoints = data.Select(x => new KeyValuePair <string, bool>(x.TriasIdStopPoint, true));

            _existsStopPoints = new ConcurrentDictionary <string, bool>(istStopPoints);
            var istStopPointCache = data.Select(x => new KeyValuePair <string, CachedStopPoint>(x.TriasIdStopPoint, new CachedStopPoint
            {
                TriasIdStopPoint = x.TriasIdStopPoint,
                Latitude         = x.Latitude,
                Longitude        = x.Longitude,
                StopPointName    = x.StopPointName
            }));

            _stopPointCache = new ConcurrentDictionary <string, CachedStopPoint>(istStopPointCache);
            var dataLines = await _publicTransportLinesCollector.GetPublicTransportLines().ConfigureAwait(false);

            _linesCache = dataLines.ToArray();
        }