private static bool DoTask(WebPosition.PersistStruct persistStruct) { using (ExtendedWebBrowser browser = new ExtendedWebBrowser()) { try { browser.Navigate(persistStruct.Url); for (int i = 0; i < 30; i++) System.Windows.Forms.Application.DoEvents(); do { System.Windows.Forms.Application.DoEvents(); } while (browser.IsBusy); } catch (Exception exc) { TraceHlp2.WriteException(exc); return false; } if (browser.Document != null && browser.Document.Body != null && browser.Document.Body.Parent != null) { lock (dataCache) { dataCache[persistStruct] = browser.Document.Body.Parent.OuterHtml; return true; } } else return false; } }
public static WebDocument Load(WebPosition position) { string content = AsyncLoader.Instance.Load(position); using( ExtendedWebBrowser browser = new ExtendedWebBrowser()) { browser.DocumentText = content; browser.IsWebBrowserContextMenuEnabled = false; // WARNING!! this can cause problems when certificate approval needed! browser.ScriptErrorsSuppressed = true; System.Windows.Forms.Application.DoEvents(); while (browser.IsBusy) System.Windows.Forms.Application.DoEvents(); return new WebDocument(DOMTreeToXml(browser.Document)); } }
public WebBrowserExtendedEvents(ExtendedWebBrowser browser) { _Browser = browser; }