Пример #1
0
        protected override async Task OnParametersSetAsync()
        {
            if (null == this.Items && !string.IsNullOrEmpty(this.FeedUrl))
            {
                var expires = await this.Storage.GetItemAsync <DateTime?>(ItemsExpireProperty);

                var items = await this.Storage.GetItemAsync <IEnumerable <RssItem> >(ItemsProperty);

                if (expires.GetValueOrDefault() < DateTime.UtcNow || null == items)
                {
                    await this.Storage.SetItemAsync(ItemsExpireProperty, DateTime.UtcNow.AddHours(1));

                    items = await RssItem.LoadAsync(this.FeedUrl, 3, new HttpClient());

                    await this.Storage.SetItemAsync(ItemsProperty, items);
                }

                this.Items = items;
            }

            await base.OnParametersSetAsync();
        }