public ScriptingObject(WebBrowser2 Browser, IXenObject XenObject) { browser = Browser; connection = XenObject.Connection; if (connection != null) { connection.ConnectionResult += new EventHandler<ConnectionResultEventArgs>(connection_ConnectionResult); } SetObject(XenObject); }
public new void SetUp() { _wb = new WebBrowser2(); MW(() => _wb.Handle); _testUris.Clear(); for (int i = 0; i < 2; i++) { string file = Path.GetTempFileName(); File.Move(file, file + ".html"); file += ".html"; File.WriteAllText(file, "<html>hello</html>"); _testUris.Add(new Uri("file://" + file)); } }
public WebBrowser2EventHelper(WebBrowser2 parent) { this.parent = parent; }
public WebBrowserSite2(WebBrowser2 Browser) : base(Browser) { this.Browser = Browser; }
public BrowserState(List<Uri> urls, IXenObject obj, WebBrowser2 browser) { Urls = new List<Uri>(urls); Obj = obj; ObjectForScripting = obj == null ? null : new ScriptingObject(browser, obj); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); BrowserStates.Clear(); if (Browser != null) { Browser.Dispose(); Browser = null; } if (_tabPage != null) { _tabPage.Dispose(); _tabPage = null; } }
/// <summary> /// Nothrow guarantee. /// </summary> void Browser_AuthenticationPrompt(WebBrowser2 sender, WebBrowserAuthenticationPromptEventArgs e) { try { Program.AssertOnEventThread(); log.Debug("Prompting for authentication..."); CompleteClearSecret(lastBrowserState); CompleteGetSecret(lastBrowserState); BrowserState.BrowserCredentials creds = lastBrowserState.Credentials; if (creds != null && creds.Valid) { e.Username = creds.Username; e.Password = creds.Password; e.Success = true; log.Debug("Prompt for authentication successful."); } else { e.Success = false; log.Debug("Prompt for authentication cancelled / failed."); } } catch (Exception exn) { log.Error("Prompt for authentication failed", exn); e.Success = false; } }
private void CreateBrowser() { Browser = new WebBrowser2(); Browser.Dock = DockStyle.Fill; Browser.IsWebBrowserContextMenuEnabled = ContextEnabled; Browser.ProgressChanged += Browser_ProgressChanged; Browser.DocumentCompleted += Browser_DocumentCompleted; Browser.Navigating += Browser_Navigating; Browser.Navigated += Browser_Navigated; Browser.NavigateError += Browser_NavigateError; Browser.WindowClosed += Browser_WindowClosed; Browser.PreviewKeyDown += Browser_PreviewKeyDown; Browser.AuthenticationPrompt += Browser_AuthenticationPrompt; // Navigate to about:blank to work around http://support.microsoft.com/kb/320153. Browser.Navigate("about:blank"); }
public WebBrowserSite2(WebBrowser2 browser) : base(browser) { Browser = browser; }