Exemplo n.º 1
0
        /// <summary>
        /// Raises the <see cref="StartNavigate"/> event
        /// </summary>
        /// <exception cref="ArgumentNullException">Thrown when BrowserExtendedNavigatingEventArgs is null</exception>
        protected void OnStartNavigate(BrowserExtendedNavigatingEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            if (this.StartNavigate != null)
            {
                this.StartNavigate(this, e);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Raises the <see cref="StartNewWindow"/> event
        /// </summary>
        /// <exception cref="ArgumentNullException">Thrown when BrowserExtendedNavigatingEventArgs is null</exception>
        protected void OnStartNewWindow(BrowserExtendedNavigatingEventArgs e, NativeMethods.NWMF flags)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            if ((flags & NativeMethods.NWMF.NWMF_SUGGESTWINDOW) == NativeMethods.NWMF.NWMF_SUGGESTWINDOW)
            {
                InvokeStartNewWindow(e);
            }
            else
            {
                InvokeStartNewTab(e);
            }
        }
Exemplo n.º 3
0
        void browser_StartNewWindow(object sender, BrowserExtendedNavigatingEventArgs e)
        {
            var index = tbMain.SelectedIndex;
            var tab   = CreateNewBrowserTab();
            var page  = new BrowserPage();

            e.AutomationObject   = _browserTabs[tab].ActiveXInstance;
            tbMain.SelectedIndex = index;
            tbMain.Items.Remove(tab);
            page.Closing += page_Closing;
            page.AssignTab(tab, _browserTabs[tab]);

            //page.Show();
            //e.Cancel = true;
            //_browserTabs[tab].Navigate(e.Url);
            //Navigate(e.Url.ToString());
        }
Exemplo n.º 4
0
            //Implement whichever events you wish
            public void BeforeNavigate2(object pDisp, ref object URL, ref object flags, ref object targetFrameName, ref object postData, ref object headers, ref bool cancel)
            {
                Uri urlUri = new Uri(URL.ToString());

                string tFrame = null;

                if (targetFrameName != null)
                {
                    tFrame = targetFrameName.ToString();
                }

                BrowserExtendedNavigatingEventArgs args = new BrowserExtendedNavigatingEventArgs(pDisp, urlUri, tFrame);

                _Browser.OnStartNavigate(args);

                cancel = args.Cancel;
                pDisp  = args.AutomationObject;
            }
Exemplo n.º 5
0
 void browser_StartNewTab(object sender, BrowserExtendedNavigatingEventArgs e)
 {
     var tab = CreateNewBrowserTab();
     e.AutomationObject = _browserTabs[tab].ActiveXInstance;
     tbMain.ItemContainerStyle = new Style(typeof(TabItem));
     tbMain.Items.Cast<TabItem>().ToList().ForEach(x => x.Visibility = Visibility.Visible);
 }
Exemplo n.º 6
0
        void browser_StartNewWindow(object sender, BrowserExtendedNavigatingEventArgs e)
        {
            var index = tbMain.SelectedIndex;
            var tab = CreateNewBrowserTab();
            var page = new BrowserPage();
            e.AutomationObject = _browserTabs[tab].ActiveXInstance;
            tbMain.SelectedIndex = index;
            tbMain.Items.Remove(tab);
            page.Closing += page_Closing;
            page.AssignTab(tab, _browserTabs[tab]);

            //page.Show();
            //e.Cancel = true;
            //_browserTabs[tab].Navigate(e.Url);
            //Navigate(e.Url.ToString());
        }
Exemplo n.º 7
0
 // NewWindow3 event, used on Windows XP SP2 and higher
 public void NewWindow3(ref object ppDisp, ref bool Cancel, uint dwFlags, string bstrUrlContext, string bstrUrl)
 {
     BrowserExtendedNavigatingEventArgs args = new BrowserExtendedNavigatingEventArgs(ppDisp, new Uri(bstrUrl), null);
     _Browser.OnStartNewWindow(args, (NativeMethods.NWMF)dwFlags);
     Cancel = args.Cancel;
     ppDisp = args.AutomationObject;
 }
Exemplo n.º 8
0
            //Implement whichever events you wish
            public void BeforeNavigate2(object pDisp, ref object URL, ref object flags, ref object targetFrameName, ref object postData, ref object headers, ref bool cancel)
            {
                Uri urlUri = new Uri(URL.ToString());

                string tFrame = null;
                if (targetFrameName != null)
                    tFrame = targetFrameName.ToString();

                BrowserExtendedNavigatingEventArgs args = new BrowserExtendedNavigatingEventArgs(pDisp, urlUri, tFrame);
                _Browser.OnStartNavigate(args);

                cancel = args.Cancel;
                pDisp = args.AutomationObject;
            }
Exemplo n.º 9
0
        /// <summary>
        /// Raises the <see cref="StartNavigate"/> event
        /// </summary>
        /// <exception cref="ArgumentNullException">Thrown when BrowserExtendedNavigatingEventArgs is null</exception>
        protected void OnStartNavigate(BrowserExtendedNavigatingEventArgs e)
        {
            if (e == null)
                throw new ArgumentNullException("e");

            if (this.StartNavigate != null)
                this.StartNavigate(this, e);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Raises the <see cref="StartNewWindow"/> event
        /// </summary>
        /// <exception cref="ArgumentNullException">Thrown when BrowserExtendedNavigatingEventArgs is null</exception>
        protected void OnStartNewWindow(BrowserExtendedNavigatingEventArgs e, NativeMethods.NWMF flags)
        {
            if (e == null)
                throw new ArgumentNullException("e");

            if ((flags & NativeMethods.NWMF.NWMF_SUGGESTWINDOW) == NativeMethods.NWMF.NWMF_SUGGESTWINDOW)
            {
                InvokeStartNewWindow(e);
            }
            else
            {
                InvokeStartNewTab(e);
            }
        }
Exemplo n.º 11
0
 public void InvokeStartNewTab(BrowserExtendedNavigatingEventArgs e)
 {
     EventHandler<BrowserExtendedNavigatingEventArgs> handler = StartNewTab;
     if (handler != null) handler(this, e);
 }
Exemplo n.º 12
0
 //The NewWindow2 event, used on Windows XP SP1 and below
 public void NewWindow2(ref object pDisp, ref bool cancel)
 {
     BrowserExtendedNavigatingEventArgs args = new BrowserExtendedNavigatingEventArgs(pDisp, null, null);
     _Browser.OnStartNewWindow(args);
     cancel = args.Cancel;
     pDisp = args.AutomationObject;
 }
Exemplo n.º 13
0
 void browser_StartNewWindow(object sender, BrowserExtendedNavigatingEventArgs e)
 {
     e.Cancel = true;
     CreateNewBrowserTab();
     Navigate(e.Url.ToString());
 }
Exemplo n.º 14
0
 void browser_StartNewWindow(object sender, BrowserExtendedNavigatingEventArgs e)
 {
     e.Cancel = true;
     CreateNewBrowserTab();
     Navigate(e.Url.ToString());
 }