public static async Task <HtmlAgilityPack.HtmlDocument> Navigate( GetUrl getUrl, IsDocumentFullyLoaded isDocumentFullyLoaded, IUserInteraction userInteraction, IWebBrowser browser) { using (var request = new WebBrowserRequest(browser, getUrl, isDocumentFullyLoaded, userInteraction)) { return(await request.Navigate()); } }
private WebBrowserRequest( IWebBrowser browser, GetUrl getUrl, IsDocumentFullyLoaded isDocumentFullyLoaded, IUserInteraction userInteraction) { this.browser = browser; this.browser.DocumentCompleted += Browser_DocumentCompleted; this.isDocumentFullyLoaded = isDocumentFullyLoaded; this.getUrl = getUrl; this.userInteraction = userInteraction; this.manualResetEvent = new ManualResetEvent(false); this.htmlDocument = new HtmlAgilityPack.HtmlDocument(); this.lockObject = new object(); }