private void watchToolStripMenuItem_Click(object sender, EventArgs e) { //TODO:Must be a better way. Background request? try { browser.Navigate(Variables.GetRemoveFromWatchlistURL(Tools.WikiEncode(ArticleTitle))); browser.Wait(); MessageBox.Show("Page successfully added to your watchlist"); } catch (Exception ex) { ErrorHandler.Handle(ex); } }
public List <Article> MakeList(params string[] searchCriteria) { Browser.WebControl webbrowser = new Browser.WebControl(); webbrowser.ScriptErrorsSuppressed = true; webbrowser.Navigate(Variables.URLLong + "index.php?title=Special:Watchlist&action=raw"); webbrowser.Wait(); List <Article> list = new List <Article>(); HtmlElement textarea = webbrowser.Document.GetElementById("titles"); string html; if (textarea == null || (html = textarea.InnerText) == null) { return(list); } try { string[] splitter = { "\r\n" }; foreach (string entry in html.Split(splitter, StringSplitOptions.RemoveEmptyEntries)) { if (entry.Length > 0) { list.Add(new Article(entry)); } } } catch (Exception ex) { ErrorHandler.Handle(ex); } return(list); }
private void unwatchToolStripMenuItem_Click(object sender, EventArgs e) { try { Browser.WebControl browser = new Browser.WebControl(); browser.Navigate(Variables.URLLong + "index.php?title=" + Tools.WikiEncode(ArticleTitle) + "&action=unwatch"); browser.Wait(); MessageBox.Show("Page successfully removed from your watchlist"); } catch (Exception ex) { ErrorHandler.Handle(ex); } }
public List<Article> MakeList(params string[] searchCriteria) { Browser.WebControl webbrowser = new Browser.WebControl {ScriptErrorsSuppressed = true}; webbrowser.Navigate(Variables.URLIndex + "?title=Special:Watchlist&action=raw"); webbrowser.Wait(); List<Article> list = new List<Article>(); if (webbrowser.Document == null) return list; HtmlElement textarea = webbrowser.Document.GetElementById("titles"); string html; if (textarea == null || (html = textarea.InnerText) == null) return list; try { string[] splitter = { "\r\n" }; foreach (string entry in html.Split(splitter, StringSplitOptions.RemoveEmptyEntries)) { if (entry.Length > 0) list.Add(new Article(entry)); } } catch (Exception ex) { ErrorHandler.Handle(ex); } return list; }