private void NavigateToThread()
        {
            try
            {
                ThreadingHelper.ExecuteInUiThread(() => _webBrowserControl.WebBrowser.Navigate(_downloadContext.ThreadUrl));
            }
            catch (Exception)
            {
                throw new Exception($"Could not navigate to '{_downloadContext.Name}'.");
            }

            // Assure we're processed
            var currentCnter = 0;

            while (!_htmlprocessed && (currentCnter < MAX_WAIT_COUNTER))
            {
                currentCnter++;
                Thread.Sleep(1000);
            }

            if (!_htmlprocessed || string.IsNullOrEmpty(_html))
            {
                throw new Exception($"Could not load HTML from URL '{_downloadContext.Name}'.");
            }
        }
 private void ReadHtmlFromControl()
 {
     ThreadingHelper.ExecuteInUiThread(() =>
     {
         var doc = (IHTMLDocument2)_webBrowserControl.WebBrowser.Document;
         _html   = doc.body.outerHTML;
     });
 }
 public WebBrowserAdapter()
 {
     ThreadingHelper.ExecuteInUiThread(() =>
     {
         _webBrowserControl = new WebBrowserUserControl();
         _webBrowserControl.WebBrowser.HideScriptErrors();
         _webBrowserControl.WebBrowser.LoadCompleted += WebBrowser_LoadCompleted;
         _webBrowserControl.Show();
     });
 }