本文整理汇总了C#中HtmlAgilityPack.HtmlWeb.LoadAsync方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlWeb.LoadAsync方法的具体用法?C# HtmlWeb.LoadAsync怎么用?C# HtmlWeb.LoadAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlAgilityPack.HtmlWeb
的用法示例。
在下文中一共展示了HtmlWeb.LoadAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PhoneApplicationPage_Loaded
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
HtmlAgilityPack.HtmlWeb htmlDoc = new HtmlAgilityPack.HtmlWeb();
htmlDoc.LoadCompleted += new EventHandler<HtmlDocumentLoadCompleted>(htmlDocComplete);
htmlDoc.LoadAsync("http://q.cnblogs.com/");
}
示例2: FetchHtml
public void FetchHtml(string url, Object token)
{
var web = new HtmlWeb();
web.LoadAsync(url);
web.LoadCompleted += delegate(object sender, HtmlDocumentLoadCompleted completed)
{
var htmlDoc = completed.Document;
if (htmlDoc.ParseErrors != null && htmlDoc.ParseErrors.Count() > 0)
{
// Handle any parse errors as required
}
else
{
//foreach (var script in htmlDoc.DocumentNode.Descendants("script").ToArray())
// script.Remove();
foreach (var style in htmlDoc.DocumentNode.Descendants("style").ToArray())
style.Remove();
if (htmlDoc.DocumentNode != null)
{
HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body");
if (bodyNode != null)
{
// Do something with bodyNode
}
}
}
};
}
示例3: PanoramaItem_Loaded
private void PanoramaItem_Loaded(object sender, RoutedEventArgs e)
{
HtmlAgilityPack.HtmlWeb htmlDoc = new HtmlAgilityPack.HtmlWeb();
htmlDoc.LoadCompleted += new EventHandler<HtmlDocumentLoadCompleted>(htmlDocComplete);
htmlDoc.LoadAsync("http://www.cnblogs.com/");
}
示例4: StartPresentationTextRetrieval
public void StartPresentationTextRetrieval(string url)
{
_hw = new HtmlWeb();
_hw.LoadCompleted += hw_LoadCompleted;
_hw.LoadAsync(url);
}
示例5: LoadFromUrl
public override void LoadFromUrl(HtmlWeb web, String url, int pageToLoad = -1)
{
Url = url;
IsLoaded = false;
_web = web;
_web.LoadCompleted += OnUrlLoaded;
_web.LoadAsync(url);
}
示例6: getSearchResult
private void getSearchResult(string searchValueHttpUri, int pageParam)
{
HtmlAgilityPack.HtmlWeb htmlDoc = new HtmlAgilityPack.HtmlWeb();
htmlDoc.LoadCompleted += new EventHandler<HtmlDocumentLoadCompleted>(htmlDocCompleteSearch);
htmlDoc.LoadAsync("http://zzk.cnblogs.com/s?w=" + searchValueHttpUri + "&t=b&p=" + pageParam + "");
}
示例7: PhoneApplicationPage_Loaded
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
//this.IndexPageTextBlock1.Text = "值是---------" + NavigationContext.QueryString["pageValue"];
HtmlAgilityPack.HtmlWeb htmlDoc = new HtmlAgilityPack.HtmlWeb();
htmlDoc.LoadCompleted += new EventHandler<HtmlDocumentLoadCompleted>(htmlDocComplete);
htmlDoc.LoadAsync("http://www.cnblogs.com/pick/");
}
示例8: PhoneApplicationPage_Loaded
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
if (NavigationContext.QueryString.Count > 0)
{
string titleHttpUri = NavigationContext.QueryString["titleLinkValue"];
HtmlAgilityPack.HtmlWeb htmlDoc = new HtmlAgilityPack.HtmlWeb();
htmlDoc.LoadCompleted += new EventHandler<HtmlDocumentLoadCompleted>(htmlDocComplete);
htmlDoc.LoadAsync(titleHttpUri);
}
}
示例9: FetchSite
private void FetchSite(object sender, RoutedEventArgs e)
{
//HtmlWeb.LoadAsync("http://www.google.com", (s, args) =>
// {
// Results.Text = String.Join(Environment.NewLine,
// args.Document.DocumentNode.Descendants("a").
// Select(
// x =>
// x.GetAttributeValue("href", "")).ToArray());
// });
var web = new HtmlWeb();
web.LoadCompleted += SiteLoaded;
web.LoadAsync("http://www.google.com");
// HtmlWeb.LoadAsync("http://www.google.com", SiteLoaded);
}
示例10: PhoneApplicationPage_Loaded
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
if (NavigationContext.QueryString.Count > 0)
{
string titleHttpUri = NavigationContext.QueryString["titleLinkValue"];
string questionUrl = "http://q.cnblogs.com"+titleHttpUri;
//MessageBox.Show(questionUrl);
HtmlAgilityPack.HtmlWeb htmlDoc = new HtmlAgilityPack.HtmlWeb();
htmlDoc.LoadCompleted += new EventHandler<HtmlDocumentLoadCompleted>(htmlDocComplete);
htmlDoc.LoadAsync(questionUrl);
}
}
示例11: LoadData
/// <summary>
/// Creates and adds a few ItemViewModel objects into the Items collection.
/// </summary>
public void LoadData()
{
HtmlWeb webGet = new HtmlWeb();
webGet.LoadCompleted += parse_RecallListCurrent;
webGet.LoadAsync(Url_HealthCanadaProductRecall_2012);
webGet.LoadAsync(Url_HealthCanadaProductRecall_2011);
HtmlWeb fGet = new HtmlWeb();
fGet.LoadCompleted += parse_RecallListForegin;
fGet.LoadAsync(Url_HealthCanadaProductRecall_f2011);
HtmlWeb cGet = new HtmlWeb();
cGet.LoadCompleted += load_ConsumerProduct;
cGet.LoadAsync(Url_HealthCanadaConsumer);
/*
HtmlWeb foodGet = new HtmlWeb();
foodGet.LoadCompleted += load_FoodSafety;
foodGet.LoadAsync(Url_FoodSafety);
*/
}
示例12: getLastestStatus
public void getLastestStatus(string trackingnNumber)
{
HtmlWeb htmlWeb = new HtmlWeb();
htmlWeb.LoadCompleted += new EventHandler<HtmlDocumentLoadCompleted>(htmlWeb_LoadCompleted);
htmlWeb.LoadAsync("http://www.verkkoposti.com/e3/TrackinternetServlet?lang=fi&LOTUS_hae=Hae&LOTUS_side=1&LOTUS_trackId=" + trackingnNumber + "&LOTUS_hae=Hae", Encoding.GetEncoding("ISO-8859-1"));
}
示例13: StartDailyTextRetrieval
/// <summary>
/// Starts the daily text retrieval.
/// </summary>
/// <param name="d">The d.</param>
public void StartDailyTextRetrieval(DateTime d)
{
string url = App.Settings.UseCustomDTUrl ? App.Settings.CustomDTUrl : string.Format(StringResources.Application_DailyTextURL, DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day);
if (string.IsNullOrEmpty(url)) return;
_hw = new HtmlWeb();
_hw.LoadCompleted += hw_LoadCompleted;
_hw.LoadAsync(url);
}
示例14: LoadFromUrl
public virtual void LoadFromUrl(HtmlWeb web, String url, int pageToLoad = -1)
{
Url = url;
IsLoaded = false;
ClearContent();
_pageToLoad = pageToLoad;
_web = web;
_web.LoadCompleted += OnUrlLoaded;
_web.LoadAsync(url);
}
示例15: Scrape
public static void Scrape(object page)
{
_page = (MainPage)page;
var web = new HtmlWeb();
web.LoadCompleted += ParseBandwidthDocument;
var settings = IsolatedStorageSettings.ApplicationSettings;
var siteToLoad = "http://netreg.rose-hulman.edu/tools/networkUsage.pl";
web.LoadAsync(siteToLoad,
new UTF8Encoding(),
(String)settings["user"],
(String)settings["pass"],
"rose-hulman");
}