Example #1
0
        static void HandleDecidePolicyForNavigation(object sender, wk.WebNavigationPolicyEventArgs e)
        {
            var handler = GetHandler(e.Frame.WebView) as WebViewHandler;

            if (handler != null)
            {
                var args = new WebViewLoadingEventArgs(new Uri(e.Request.Url.AbsoluteString), e.Frame == handler.Control.MainFrame);
                handler.Widget.OnDocumentLoading(args);
                if (args.Cancel)
                {
                    e.DecisionToken.PerformSelector(selIgnore, null, 0);
                }
                else
                {
                    e.DecisionToken.PerformSelector(selUse, null, 0);
                }
            }
        }
Example #2
0
        void HandleDecidePolicyForNavigation(object sender, MonoMac.WebKit.WebNavigationPolicyEventArgs e)
        {
            switch (e.OriginalUrl.Scheme)
            {
            case "ecma":
                WebView.DecideIgnore(e.DecisionToken);
                var url = e.OriginalUrl.AbsoluteString.Substring(7);
                CurrentObject = DocModel.ParseReference(url);
                return;

            // This is one of our rendered ecma links, we want to extract the target
            // from the text, not the href attribute value (since this is not easily
            // editable, and the text is.
            case "goto":
                url           = RunJS("getText", e.OriginalUrl.Host);
                CurrentObject = DocModel.ParseReference(url);
                break;
            }
            WebView.DecideUse(e.DecisionToken);
        }