Ejemplo n.º 1
0
 public ScriptingObject(WebBrowser2 Browser, IXenObject XenObject)
 {
     browser = Browser;
     connection = XenObject.Connection;
     if (connection != null)
     {
         connection.ConnectionResult += new EventHandler<ConnectionResultEventArgs>(connection_ConnectionResult);
     }
     SetObject(XenObject);
 }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 3
0
 public WebBrowser2EventHelper(WebBrowser2 parent)
 {
     this.parent = parent;
 }
Ejemplo n.º 4
0
 public WebBrowserSite2(WebBrowser2 Browser)
     : base(Browser)
 {
     this.Browser = Browser;
 }
Ejemplo n.º 5
0
 public BrowserState(List<Uri> urls, IXenObject obj, WebBrowser2 browser)
 {
     Urls = new List<Uri>(urls);
     Obj = obj;
     ObjectForScripting = obj == null ? null : new ScriptingObject(browser, obj);
 }
Ejemplo n.º 6
0
        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;
            }
        }
Ejemplo n.º 7
0
        /// <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;
            }
        }
Ejemplo n.º 8
0
        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");
        }
Ejemplo n.º 9
0
 public WebBrowser2EventHelper(WebBrowser2 parent)
 {
     this.parent = parent;
 }
Ejemplo n.º 10
0
 public WebBrowserSite2(WebBrowser2 Browser)
     : base(Browser)
 {
     this.Browser = Browser;
 }
Ejemplo n.º 11
0
 public WebBrowserSite2(WebBrowser2 browser)
     : base(browser)
 {
     Browser = browser;
 }