Пример #1
0
        // this event can be used to canel the navigation and open a new window
        // if window set to same then nothing happens
        private void BrowserBeforeNavigate(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
        {
            string url = e.uRL.ToString();
            if (!codeNavigate)
            {
                // call the appropriate event processing
                HtmlNavigationEventArgs navigateArgs = new HtmlNavigationEventArgs(url);
                OnHtmlNavigation(navigateArgs);

                // process the event based on the navigation option
                if (navigateArgs.Cancel)
                {
                    // cancel the navigation
                    e.cancel = true;
                }
                else if (_navigateWindow == NavigateActionOption.NewWindow)
                {
                    // cancel the current navigation and load url into a new window
                    e.cancel = true;
                    this.NavigateToUrl(url, true);
                }
                else
                {
                    // continue with current navigation
                    e.cancel = false;
                }
            }
            else
            {
                // TODO Should ensure the following are no executed for the editor navigation
                //   Scripts
                //   Java
                //   ActiveX Controls
                //   Behaviors
                //   Dialogs

                // continue with current navigation
                e.cancel = false;
            }
        }
Пример #2
0
 //processing for the HtmlNavigation event
 private void OnHtmlNavigation(HtmlNavigationEventArgs args)
 {
     if (HtmlNavigation != null)
     {
         HtmlNavigation(this, args);
     }
 }
Пример #3
0
 private void htmlEditorControl_HtmlNavigation(object sender, Microsoft.ConsultingServices.HtmlEditor.HtmlNavigationEventArgs e)
 {
     e.Cancel = false;
 }