/// <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"); } EventHandler <BrowserExtendedNavigatingEventArgs> handler = StartNavigate; if (handler != null) { handler(this, e); } }
//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, UrlContext.None); _Browser.OnStartNavigate(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) { BrowserExtendedNavigatingEventArgs args = new BrowserExtendedNavigatingEventArgs(ppDisp, new Uri(bstrUrl), null, (UrlContext)dwFlags); _Browser.OnStartNewWindow(args); Cancel = args.Cancel; ppDisp = args.AutomationObject; }
//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, UrlContext.None); _Browser.OnStartNewWindow(args); cancel = args.Cancel; pDisp = args.AutomationObject; }
//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, UrlContext.None); _Browser.OnStartNavigate(args); cancel = args.Cancel; pDisp = args.AutomationObject; }
/// <summary> /// Raises the <see cref="StartNewWindow"/> event /// </summary> /// <exception cref="ArgumentNullException">Thrown when BrowserExtendedNavigatingEventArgs is null</exception> protected void OnStartNewWindow(BrowserExtendedNavigatingEventArgs e) { if (e == null) throw new ArgumentNullException("e"); EventHandler<BrowserExtendedNavigatingEventArgs> handler = StartNewWindow; if (handler != null) handler(this, e); }