예제 #1
0
        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();
            }
        }
예제 #2
0
 void ComWebBrowser_NewWindow(
     string URL,
     int Flags,
     string TargetFrameName,
     ref object PostData,
     string Headers,
     ref bool Processed)
 => NewWindow?.Invoke(URL, TargetFrameName, ref Processed);
예제 #3
0
 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);
     });
 }
예제 #4
0
        protected override DependencyObject GetContainerForItemOverride()
        {
            var window = new MdiWindow();
            Windows.Add(window);

            if (NewWindow != null)
            {
                NewWindow.Invoke(this, new NewWindowEventArgs() { Window = window });
            }

            return window;
        }
예제 #5
0
 public void OnNewWindow(EventArgs e)
 {
     NewWindow?.Invoke(this, e);
 }
예제 #6
0
 private void ExtandedWebBrowser1_StartNewWindow(object sender, ExtandedUserControl.BrowserExtendedNavigatingEventArgs e)
 {
     e.Cancel = true;
     NewWindow?.Invoke(this, new NewWindowEventArgs(e.Url.ToString()));
 }