private void redditWorker_DoWork(object sender, DoWorkEventArgs e) { string url = @"http://www.reddit.com" + _subreddit + "/hot.json"; string json = String.Empty; try { json = downloader.webRead(url); } catch(Exception ex) { logIt.add(ex.ToString()); return; } var topic = JsonConvert.DeserializeObject<RootObject>(json); foreach (Child i in topic.data.children) { if (i.data.link_flair_text == "EVENT") { var evt = new events {title = i.data.title, author = i.data.author, url = i.data.permalink}; _rposts.Add(evt); } } }
void redditWorker_DoWork(object sender, DoWorkEventArgs e) { string url = @"http://www.reddit.com" + subreddit + "/hot.json"; string json = downloader.webRead(url); RootObject topic = JsonConvert.DeserializeObject <RootObject>(json); foreach (Child i in topic.data.children) { if (i.data.link_flair_text == "EVENT") { events evt = new events(); evt.title = i.data.title; evt.author = i.data.author; evt.url = i.data.permalink; rposts.Add(evt); } } }
void redditWorker_DoWork(object sender, DoWorkEventArgs e) { var reddit = new Reddit(); var rsubreddit = reddit.GetSubreddit(subreddit); var posts = rsubreddit.GetHot(); foreach (var post in posts.Take(20)) { if (post.LinkFlairText == "EVENT") { events evt = new events(); evt.title = post.Title.ToString(); evt.author = post.Author.ToString(); evt.url = post.Shortlink; rposts.Add(evt); } } }
void redditWorker_DoWork(object sender, DoWorkEventArgs e) { string url = @"http://www.reddit.com" + subreddit + "/hot.json"; string json = downloader.webRead(url); RootObject topic = JsonConvert.DeserializeObject<RootObject>(json); foreach(Child i in topic.data.children) { if (i.data.link_flair_text == "EVENT") { events evt = new events(); evt.title = i.data.title; evt.author = i.data.author; evt.url = i.data.permalink; rposts.Add(evt); } } }