Пример #1
0
            public void HandleNewWindowPolicyDecisionRequested(object sender, NewWindowPolicyDecisionRequestedArgs args)
            {
                var handler = Handler;
                var e       = new WebViewNewWindowEventArgs(new Uri(args.Request.Uri), args.Frame.Name);

                handler.Callback.OnOpenNewWindow(handler.Widget, e);
                                #if GTK2
                if (e.Cancel)
                {
                    args.Decision.Ignore();
                }
                else
                {
                    args.Decision.Use();
                }
                                #else
                if (e.Cancel)
                {
                    args.PolicyDecision.Ignore();
                }
                else
                {
                    args.PolicyDecision.Use();
                }
                                #endif
                args.RetVal = true;
            }
Пример #2
0
            public void HandleNewWindowPolicyDecisionRequested(object sender, NewWindowPolicyDecisionRequestedArgs args)
            {
                var handler = Handler;
                var e       = new WebViewNewWindowEventArgs(new Uri(args.Request.Uri), args.Frame.Name);

                handler.Callback.OnOpenNewWindow(handler.Widget, e);
                                #if GTK2
                var decision = args.Decision;
                                #else
                var decision = args.PolicyDecision;
                                #endif
                if (decision != null)
                {
                    if (e.Cancel)
                    {
                        decision.Ignore();
                    }
                    else
                    {
                        decision.Use();
                        Application.Instance.Open(args.Request.Uri);
                    }
                }
                args.RetVal = true;
            }