/// <summary> /// Beging getting document by the url. /// </summary> /// <param name="url"></param> /// <returns></returns> public bool Navigate(string url) { try { IE_result = false; lock (completed_urls) { completed_urls.Clear(); } init_loading(url); init_loading_progress(url); IeRoutines.Invoke(browser, () => { browser.Navigate(url); }); IE_result = true; return(IE_result); } catch (ThreadAbortException) { } catch (Exception error) { web_routine_status = WebRoutineStatus.EXCEPTION; Log.Error(error.Message + "\nURL: " + url + "\nIE using"); } IE_result = false; return(IE_result); }
public IeRoutine(WebBrowser browser) { IeRoutines.Invoke(browser, () => { if (_CloseWebBrowserDialogsAutomatically) { browser.ScriptErrorsSuppressed = true; WindowInterceptor.AddOwnerWindow(browser.Handle); } browser.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(Browser_Navigating); browser.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(Browser_DocumentCompleted); browser.NewWindow += new System.ComponentModel.CancelEventHandler(browser_NewWindow); browser.ProgressChanged += new WebBrowserProgressChangedEventHandler(browser_ProgressChanged); //browser.ScriptErrorsSuppressed = Properties.Web.Default.flagWebBrowserScriptErrorsSuppressed; this.browser = browser; //needed to make google (and probably other sites) work correctly //if (!InternetExplorerBrowserEmulation.IsBrowserEmulationSet()) // InternetExplorerBrowserEmulation.SetBrowserEmulationVersion(); }); }
internal void CloseIE() { try { IeRoutines.Invoke(browser, () => { if (browser != null) { GetDoc("about:blank"); browser.Dispose(); browser = null; } }); } catch (ThreadAbortException) { } catch (Exception error) { Log.Error(error); } }