Ejemplo n.º 1
0
        public void TestMultipleUrisWithOneValid()
        {
            Uri  uri1       = _testUris[0];
            Uri  uri2       = new Uri("http://fgdfgd.dfgdfgd.dfg");
            bool navigating = false;
            bool navigated  = false;

            _wb.Navigating += (s, e) =>
            {
                Assert.AreEqual(uri1, e.Url, "Incorrect Uri in Navigation");
                Assert.IsFalse(navigating);
                navigating = true;
            };

            _wb.Navigated += (s, e) =>
            {
                Assert.AreEqual(uri1, e.Url, "Incorrect Uri in Navigation");
                Assert.IsFalse(navigated);
                navigated = true;
            };

            _wb.NavigateError += (s, e) => Assert.Fail("Navigation failed.");

            var uris = new[] { uri1, uri2 };

            foreach (var uri in uris)
            {
                var curUri = uri;
                MW(() => _wb.Navigate(curUri));
                MWWaitFor(() => navigating && navigated, "Navigation didn't take place.");
            }
        }
Ejemplo n.º 2
0
        private void CreateBrowser()
        {
            Browser      = new WebBrowser2();
            Browser.Dock = DockStyle.Fill;
            Browser.IsWebBrowserContextMenuEnabled = ContextEnabled;
            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.º 3
0
        protected virtual void OnDocumentCompleted(WebBrowser2 browser, WebBrowserDocumentCompletedEventArgs e)
        {
            string uri = e.Url.AbsolutePath;
            Uri    url = null;

            try
            {
                url = new Uri(this.JumpWhenPage);
                if (url.AbsolutePath == uri)
                {
                    browser.Navigate(this.StartPageUri);
                }
            }
            catch
            {
                this.EndFill();
                WebFillManager.ShowMessageBox(string.Format("填报类型{0}的StartFillPageUri的url地址不正确!", base.FillType), "错误",
                                              MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
        }
Ejemplo n.º 4
0
 private void pictureBox2_Click(object sender, EventArgs e)
 {
     WebBrowser1.Navigate(TextBox2.Text + TextBox1.Text + TextBox3.Text);
     WebBrowser2.Navigate(TextBox9.Text + TextBox1.Text + TextBox8.Text);
 }
Ejemplo n.º 5
0
 private void Panel3_Click(object sender, System.EventArgs e)
 {
     WebBrowser1.Navigate(TextBox2.Text + TextBox1.Text + TextBox3.Text);
     WebBrowser2.Navigate(TextBox9.Text + TextBox1.Text + TextBox8.Text);
 }
Ejemplo n.º 6
0
 private void Button1_Click(System.Object sender, System.EventArgs e)
 {
     WebBrowser1.Navigate(TextBox2.Text + TextBox1.Text + TextBox3.Text);
     WebBrowser2.Navigate(TextBox9.Text + TextBox1.Text + TextBox8.Text);
 }
Ejemplo n.º 7
0
 public PanoramaPageContato()
 {
     InitializeComponent();
     WebBrowser1.Navigate(new Uri("http://www.facebook.com", UriKind.Absolute));
     WebBrowser2.Navigate(new Uri("http://www.twitter.com", UriKind.Absolute));
 }
Ejemplo n.º 8
0
        private void CrearPestaña()
        {
            Estado.Text = "New Tab";

            TabPage newtab = new TabPage("Nueva Pestaña ");
            ContarPestaña++; //variable que lleva el control de la cantidad de pestaña creada
            ListaPestaña.Add(newtab);
            Navegador1.SelectedTab = newtab; //seleccionamos la pestaña
            Navegador1.TabPages.Add(newtab); //cargamos la pestaña en el control

            //Se crea objeto browser
            WebBrowser2 wb = new WebBrowser2();
            newtab.Controls.Add(wb);
            wb.Dock = DockStyle.Fill;
            wb.ScriptErrorsSuppressed = false;
            wb.NavigateError += new WebBrowserNavigateErrorEventHandler(wb_NavigateError);//Control de errores
            wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_completa);// ebento que se ejequta al terminar de cargar la pagina

            wb.Navigate(Home);
        }