private void OnNewWindow(object sender, CancelEventArgs args) { switch (_newWindowsBehavior) { case NewWindowsBehavior.Ignore: args.Cancel = true; break; case NewWindowsBehavior.ReplaceCurrent: _inner?.Navigate(_inner.StatusText); args.Cancel = true; break; case NewWindowsBehavior.OpenInBrowser: break; case NewWindowsBehavior.MultiTab: NewWindow?.Invoke(this, new NewWindowEventArgs(_inner?.StatusText ?? string.Empty)); args.Cancel = true; break; case NewWindowsBehavior.Callback: var newArgs = new NewWindowEventArgs(_inner?.StatusText ?? string.Empty); NewWindow?.Invoke(this, newArgs); args.Cancel = newArgs.Cancel; break; default: throw new ArgumentOutOfRangeException(); } }
void ComWebBrowser_NewWindow( string URL, int Flags, string TargetFrameName, ref object PostData, string Headers, ref bool Processed) => NewWindow?.Invoke(URL, TargetFrameName, ref Processed);
public void SetNewWindowsBehavior(NewWindowsBehavior mode) { if (_inner == null) { return; } _inner.LifeSpanHandler = new LifeSpanHandler(mode, url => { var args = new NewWindowEventArgs(url); NewWindow?.Invoke(this, args); return(args.Cancel); }); }
protected override DependencyObject GetContainerForItemOverride() { var window = new MdiWindow(); Windows.Add(window); if (NewWindow != null) { NewWindow.Invoke(this, new NewWindowEventArgs() { Window = window }); } return window; }
public void OnNewWindow(EventArgs e) { NewWindow?.Invoke(this, e); }
private void ExtandedWebBrowser1_StartNewWindow(object sender, ExtandedUserControl.BrowserExtendedNavigatingEventArgs e) { e.Cancel = true; NewWindow?.Invoke(this, new NewWindowEventArgs(e.Url.ToString())); }