-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefault.aspx.cs
38 lines (33 loc) · 1.33 KB
/
Default.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.ServiceModel.Syndication;
using System.Threading.Tasks;
using System.Web.UI;
using Microsoft.Extensions.Options;
using SampleWebApplication.Options;
using SampleWebApplication.Services;
namespace SampleWebApplication
{
public partial class Default : System.Web.UI.Page
{
private readonly ISyndicationClient syndicationClient;
private readonly ApplicationOptions applicationOptions;
private readonly FeedOptions feedOptions;
public Default(ISyndicationClient syndicationClient, IOptions<ApplicationOptions> applicationOptions, IOptions<FeedOptions> feedOptions)
{
this.syndicationClient = syndicationClient;
this.applicationOptions = applicationOptions.Value;
this.feedOptions = feedOptions.Value;
}
protected SyndicationFeed SyndicationFeed { get; private set; }
protected void Page_Load(object sender, EventArgs e)
{
this.RegisterAsyncTask(new PageAsyncTask(LoadSyndicationFeedAsync));
}
private async Task LoadSyndicationFeedAsync()
{
this.SyndicationFeed = await this.syndicationClient.GetSyndicationFeedAsync(this.feedOptions.Uri);
this.FeedItemsDataList.DataSource = this.SyndicationFeed.Items;
this.DataBind();
}
}
}