예제 #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);
 }
예제 #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));
            }
        }
예제 #3
0
 public WebBrowser2EventHelper(WebBrowser2 parent)
 {
     this.parent = parent;
 }
예제 #4
0
 public WebBrowserSite2(WebBrowser2 Browser)
     : base(Browser)
 {
     this.Browser = Browser;
 }
예제 #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);
 }
예제 #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;
            }
        }
예제 #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;
            }
        }
예제 #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");
        }
예제 #9
0
 public WebBrowser2EventHelper(WebBrowser2 parent)
 {
     this.parent = parent;
 }
예제 #10
0
 public WebBrowserSite2(WebBrowser2 Browser)
     : base(Browser)
 {
     this.Browser = Browser;
 }
예제 #11
0
 public WebBrowserSite2(WebBrowser2 browser)
     : base(browser)
 {
     Browser = browser;
 }