コード例 #1
0
 public void NewWindow2(ref object ppDisp, ref bool Cancel)
 {
     try
     {
         Delegate handler = this.GetHandler(WebBrowserEvent.NewWindow2);
         if (handler != null)
         {
             NewWindow2EventArgs e = new NewWindow2EventArgs();
             e.ppDisp = ppDisp;
             e.Cancel = Cancel;
             this.Raise(handler, e);
             ppDisp = e.ppDisp;
             Cancel = e.Cancel;
         }
         handler = this.GetHandler(WebBrowserEvent.LegacyBrowserExtendedBeforeNewWindow);
         if (handler != null)
         {
             BrowserExtendedNewWindowEventArgs args2 = new BrowserExtendedNewWindowEventArgs();
             args2.pDisp = ppDisp;
             this.Raise(handler, args2);
             ppDisp = args2.pDisp;
             Cancel = args2.Cancel;
         }
     }
     catch (Exception ex) { Trace.WriteLine("NewWindow2 exception: " + ex.Message + "\r\n" + ex.StackTrace); }
 }
コード例 #2
0
        private void extendedWebBrowser1_NewWindow2(object sender, NewWindow2EventArgs e)
        {
            //Intercepting this event will allow us to create a new form in which
            //we will open the new webpage, to do that we must set the ppDisp property
            //of the NewWindow2EventArgs
            FormWithExtendedBrowser form1 = new FormWithExtendedBrowser();

            form1.Show();
            e.PPDisp = form1.extendedWebBrowser1.Application;
        }
コード例 #3
0
    protected void OnNewWindow2(ref object ppDisp, ref bool cancel)
    {
        EventHandler <NewWindow2EventArgs> h = NewWindow2;
        NewWindow2EventArgs args             = new NewWindow2EventArgs(ref ppDisp, ref cancel);

        if (null != h)
        {
            h(this, args);
        }
        //Pass the cancellation chosen back out to the events
        //Pass the ppDisp chosen back out to the events
        cancel = args.Cancel;
        ppDisp = args.PPDisp;
    }
コード例 #4
0
ファイル: WebbrowserForm.cs プロジェクト: RH-Code/GAPP
 void WebbrowserForm_NewWindow2(object sender, NewWindow2EventArgs e)
 {
     newTab(null, e);
 }
コード例 #5
0
ファイル: WebbrowserForm.cs プロジェクト: RH-Code/GAPP
        private BrowserTab newTab(string url, NewWindow2EventArgs e)
        {
            if (tabControl1.TabPages.Count == 0)
            {
                setBrowserEmulationMode(System.IO.Path.GetFileName(System.Reflection.Assembly.GetEntryAssembly().Location));
#if DEBUG
                setBrowserEmulationMode(System.IO.Path.GetFileName(System.Reflection.Assembly.GetEntryAssembly().Location).Replace(".exe",".vshost.exe"));
#endif
            }

            BrowserTab result = new BrowserTab(this);
            if (e != null)
            {
                e.PPDisp = (result.Browser as ExtendedWebBrowser).Application;
            }

            //scripting stuff
            result.ControlContainer = new FlowLayoutPanel();
            result.ControlContainer.Dock = DockStyle.Fill;
            result.ControlContainer.AutoScroll = true;
            result.ControlContainer.FlowDirection = FlowDirection.TopDown;
            result.Scripts = new List<BrowserScript>();
            result.Scripts.AddRange(getBrowserScripts(Assembly.GetExecutingAssembly(), result, true));
            if (_userScripts != null)
            {
                Assembly asm = _userScripts.CompiledAssembly;
                if (asm != null)
                {
                    result.Scripts.AddRange(getBrowserScripts(asm, result, false));
                }
            }
            foreach (BrowserScript bs in result.Scripts)
            {
                if (bs.HasControls)
                {
                    Label l = new Label();
                    l.Dock = DockStyle.Top;
                    l.AutoSize = false;
                    l.TextAlign = ContentAlignment.MiddleCenter;
                    l.BackColor = Color.LightCyan;
                    l.Text = Utils.LanguageSupport.Instance.GetTranslation(bs.Name);
                    result.ControlContainer.Controls.Add(l);
                    bs.CreateControls(result.ControlContainer.Controls);
                }
            }
            tabControl1_Selecting(this, null);
            tabControl1.TabPages.Add(result);
            tabControl1.SelectedIndex = tabControl1.TabPages.Count - 1;
            result.Browser.ScriptErrorsSuppressed = Properties.Settings.Default.ScriptErrorsSuppressed;
            result.Browser.StatusTextChanged += new EventHandler(Browser_StatusTextChanged);
            result.Browser.DocumentTitleChanged += new EventHandler(Browser_DocumentTitleChanged);
            result.Browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(Browser_DocumentCompleted);
            result.Browser.CanGoBackChanged += new EventHandler(Browser_CanGoBackChanged);
            result.Browser.CanGoForwardChanged += new EventHandler(Browser_CanGoForwardChanged);
            (result.Browser as ExtendedWebBrowser).NewWindow2 +=new EventHandler<NewWindow2EventArgs>(WebbrowserForm_NewWindow2);
            result.Text = result.Browser.DocumentTitle;
            if (url != null)
            {
                comboBox1.Text = url;
                result.Browser.Navigate(url);
            }
            tabControl1_Selected(this, null);

            int max = 10;
            foreach (Control c in result.ControlContainer.Controls)
            {
                if (c.Width > max)
                {
                    max = c.Width;
                }
            }
            splitContainer1.SplitterDistance = max;
            button6.Enabled = true;

            return result;
        }
コード例 #6
0
 protected void OnNewWindow2(ref object ppDisp, ref bool cancel)
 {
     EventHandler<NewWindow2EventArgs> h = NewWindow2;
     NewWindow2EventArgs args = new NewWindow2EventArgs(ref ppDisp, ref cancel);
     if (null != h)
     {
         h(this, args);
     }
     //Pass the cancellation chosen back out to the events
     //Pass the ppDisp chosen back out to the events
     cancel = args.Cancel;
     ppDisp = args.PPDisp;
 }
コード例 #7
0
ファイル: BrowserForm.cs プロジェクト: carpedm20/UNIST-robot
        void SourceBrowser_NewWindow2(object sender, NewWindow2EventArgs e)
        {
            TabPage NewTabPage = new TabPage();

            /*
            if (((ExtendedWebBrowser)sender).Url.ToString().IndexOf("cyworld") != -1 || ((ExtendedWebBrowser)sender).Url.ToString().IndexOf("nate") != -1)
            {
                return;
            }
            */
            ExtendedWebBrowser NewTabBrowser = new ExtendedWebBrowser()
            {
                Parent = NewTabPage,
                Dock = DockStyle.Fill,
                Tag = NewTabPage
            };

            e.PPDisp = NewTabBrowser.Application;
            InitializeBrowserEvents(NewTabBrowser);

            tabControl.TabPages.Add(NewTabPage);
            tabControl.SelectedTab = NewTabPage;
        }
コード例 #8
0
ファイル: WebbrowserForm.cs プロジェクト: pheijmans-zz/GAPP
 void WebbrowserForm_NewWindow2(object sender, NewWindow2EventArgs e)
 {
     newTab(null, e);
 }
コード例 #9
0
ファイル: WebbrowserForm.cs プロジェクト: pheijmans-zz/GAPP
        private BrowserTab newTab(string url, NewWindow2EventArgs e)
        {
            if (tabControl1.TabPages.Count == 0)
            {
                setBrowserEmulationMode(System.IO.Path.GetFileName(System.Reflection.Assembly.GetEntryAssembly().Location));
#if DEBUG
                setBrowserEmulationMode(System.IO.Path.GetFileName(System.Reflection.Assembly.GetEntryAssembly().Location).Replace(".exe", ".vshost.exe"));
#endif
            }

            BrowserTab result = new BrowserTab(this);
            if (e != null)
            {
                e.PPDisp = (result.Browser as ExtendedWebBrowser).Application;
            }

            //scripting stuff
            result.ControlContainer               = new FlowLayoutPanel();
            result.ControlContainer.Dock          = DockStyle.Fill;
            result.ControlContainer.AutoScroll    = true;
            result.ControlContainer.FlowDirection = FlowDirection.TopDown;
            result.Scripts = new List <BrowserScript>();
            result.Scripts.AddRange(getBrowserScripts(Assembly.GetExecutingAssembly(), result, true));
            if (_userScripts != null)
            {
                Assembly asm = _userScripts.CompiledAssembly;
                if (asm != null)
                {
                    result.Scripts.AddRange(getBrowserScripts(asm, result, false));
                }
            }
            foreach (BrowserScript bs in result.Scripts)
            {
                if (bs.HasControls)
                {
                    Label l = new Label();
                    l.Dock      = DockStyle.Top;
                    l.AutoSize  = false;
                    l.TextAlign = ContentAlignment.MiddleCenter;
                    l.BackColor = Color.LightCyan;
                    l.Text      = Utils.LanguageSupport.Instance.GetTranslation(bs.Name);
                    result.ControlContainer.Controls.Add(l);
                    bs.CreateControls(result.ControlContainer.Controls);
                }
            }
            tabControl1_Selecting(this, null);
            tabControl1.TabPages.Add(result);
            tabControl1.SelectedIndex                          = tabControl1.TabPages.Count - 1;
            result.Browser.ScriptErrorsSuppressed              = PluginSettings.Instance.ScriptErrorsSuppressed;
            result.Browser.StatusTextChanged                  += new EventHandler(Browser_StatusTextChanged);
            result.Browser.DocumentTitleChanged               += new EventHandler(Browser_DocumentTitleChanged);
            result.Browser.DocumentCompleted                  += new WebBrowserDocumentCompletedEventHandler(Browser_DocumentCompleted);
            result.Browser.CanGoBackChanged                   += new EventHandler(Browser_CanGoBackChanged);
            result.Browser.CanGoForwardChanged                += new EventHandler(Browser_CanGoForwardChanged);
            (result.Browser as ExtendedWebBrowser).NewWindow2 += new EventHandler <NewWindow2EventArgs>(WebbrowserForm_NewWindow2);
            result.Text = result.Browser.DocumentTitle;
            if (url != null)
            {
                comboBox1.Text = url;
                result.Browser.Navigate(url);
            }
            tabControl1_Selected(this, null);

            int max = 10;
            foreach (Control c in result.ControlContainer.Controls)
            {
                if (c.Width > max)
                {
                    max = c.Width;
                }
            }
            splitContainer1.SplitterDistance = max;
            button6.Enabled = true;

            return(result);
        }
コード例 #10
0
ファイル: MainForm.cs プロジェクト: staherianYMCA/test
 private void WebBrowserOnNewWindow2(object sender, NewWindow2EventArgs newWindow2EventArgs)
 {
     newWindow2EventArgs.PPDisp = webBrowser.Application;
 }
コード例 #11
0
ファイル: frmBrowser.cs プロジェクト: hooku/porker
 void pk_browser_NewWindow2(object sender, NewWindow2EventArgs e)
 {
     e.PPDisp = poker_add_page();
 }