//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 urlStr = new Uri(URL.ToString()); string targetFrameNameStr = (string)targetFrameName; AdvancedWebBrowserNavigatingEventArgs args = new AdvancedWebBrowserNavigatingEventArgs( pDisp, urlStr, flags, targetFrameNameStr, postData, headers, UrlContext.None ); this._wb.OnBeforeNavigate2(args); cancel = args.Cancel; pDisp = args.AutomationObject; postData = args.PostData; headers = args.Headers; }
/// <summary> /// Raises the <see cref="BeforeNavigate2"/> event /// </summary> /// <exception cref="ArgumentNullException">Thrown when BrowserExtendedNavigatingEventArgs is null</exception> protected void OnBeforeNavigate2(AdvancedWebBrowserNavigatingEventArgs e) { if (null == this.BeforeNavigate2) { return; } this.BeforeNavigate2(this, e); }
/// <summary> /// Raises the <see cref="NewWindow3"/> event /// </summary> /// <exception cref="ArgumentNullException">Thrown when BrowserExtendedNavigatingEventArgs is null</exception> protected void OnNewWindow3(AdvancedWebBrowserNavigatingEventArgs e) { if (null == this.NewWindow3) { return; } this.NewWindow3(this, e); }
//The NewWindow2 event, used on Windows XP SP1 and below public void NewWindow2(ref object pDisp, ref bool cancel) { AdvancedWebBrowserNavigatingEventArgs args = new AdvancedWebBrowserNavigatingEventArgs( pDisp, null, null, null, null, null, UrlContext.None ); this._wb.OnNewWindow3(args); cancel = args.Cancel; pDisp = args.AutomationObject; }
// NewWindow3 event, used on Windows XP SP2 and higher public void NewWindow3( ref object ppDisp, ref bool Cancel, uint dwFlags, string bstrUrlContext, string bstrUrl) { AdvancedWebBrowserNavigatingEventArgs args = new AdvancedWebBrowserNavigatingEventArgs( ppDisp, new Uri(bstrUrl), null, null, null, null, (UrlContext)dwFlags); this._wb.OnNewWindow3(args); Cancel = args.Cancel; ppDisp = args.AutomationObject; }