예제 #1
0
        private async void LoadLastUpdates()
        {
            var updatesDownloader = new UpdatesDownloader();

            _lastUpdatesTask = updatesDownloader.Parse(null);
            await _lastUpdatesTask;

            _updateItems = _lastUpdatesTask.Result.Patterns.ToList();
        }
예제 #2
0
        public async Task <IEnumerable <CrossStitchPatternModel> > GetUpdates(string lastSavedId)
        {
            await _lastUpdatesTask;
            var   hasSavedId = int.TryParse(lastSavedId, out var lastId);
            var   pageId     = 1;

            while (hasSavedId && !_updateItems.Any(i => i.PatternId.Id == lastId))
            {
                var updatesDownloader = new UpdatesDownloader();
                var pageContent       = await updatesDownloader.Parse(++pageId);

                _updateItems.AddRange(pageContent.Patterns);
            }
            return(_updateItems);
        }