using Aspose.Html;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Aspose.HTML.Demo
{
class Program
{
static void Main(string[] args)
{
var document = new HTMLDocument();
Thread thread = null;
Console.WriteLine("Thread id={0}", Thread.CurrentThread.ManagedThreadId);
document.OnReadyStateChange += (sender, @event) =>
{
Console.WriteLine(document.ReadyState);
if (thread == null)
thread = Thread.CurrentThread;
if (document.ReadyState == "complete")
{
Console.WriteLine("Count={0}", document.Body.GetElementsByTagName("p").Count());
thread.Abort();
}
};
document.Navigate("https://asposedemo20170904120448.azurewebsites.net/");
while (thread == null)
{
Thread.Sleep(10);
}
Console.WriteLine("Thread id={0}",thread.ManagedThreadId);
thread.Join();
Console.WriteLine("Waiting for keypress...");
Console.ReadKey();
}
}
}
Comments