Ejemplo n.º 1
0
        public async Task <Station[]> GetStationsAsync()
        {
            if ((_stations == null) && IsConnectionAvailable)
            {
                try
                {
                    _stations = await MetroAccessor.GetStationsAsync(true);
                    await Import(_railways, _stations);

                    _errorCount = 0;
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }

            return(_stations);
        }
Ejemplo n.º 2
0
        public async Task <Train[]> GetTrainsAsync(TimeSpan timeLength)
        {
            if (((_trains == null) || (_cachedTime + timeLength < DateTimeOffset.Now)) &&
                IsConnectionAvailable)
            {
                try
                {
                    _trains = await MetroAccessor.GetTrainsAsync();

                    _cachedTime = DateTimeOffset.Now;
                    _errorCount = 0;
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }

            return(_trains);
        }