public override bool ShouldStartLoad(UIWebView webView, Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType)
        {
            WebNavigationEvent navEvent = WebNavigationEvent.NewPage;

            switch (navigationType)
            {
            case UIWebViewNavigationType.LinkClicked:
                navEvent = WebNavigationEvent.NewPage;
                break;

            case UIWebViewNavigationType.FormSubmitted:
                navEvent = WebNavigationEvent.NewPage;
                break;

            case UIWebViewNavigationType.Reload:
                navEvent = WebNavigationEvent.Refresh;
                break;

            case UIWebViewNavigationType.FormResubmitted:
                navEvent = WebNavigationEvent.NewPage;
                break;

            case UIWebViewNavigationType.Other:
                navEvent = WebNavigationEvent.NewPage;
                break;
            }

            lastEvent = navEvent;

            Console.WriteLine("[Custom Delegate] Url: {0}", request.Url);
            Console.WriteLine("[Custom Delegate] MainDocUrl: {0}", request.MainDocumentURL);
            return(true);
        }
Beispiel #2
0
 protected override bool ShouldStartLoad(Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType)
 {
     if (request.Url.AbsoluteString.StartsWith("file://", StringComparison.Ordinal))
     {
         return(base.ShouldStartLoad(request, navigationType));
     }
     ViewModel.GoToLinkCommand.ExecuteIfCan(request.Url.AbsoluteString);
     return(false);
 }
Beispiel #3
0
        protected override void StartVisit()
        {
            _webView.NavigationDelegate = this;
            _webView.PageLoadDelegate   = this;

            var request = new Foundation.NSUrlRequest(_location);

            _navigation = _webView.LoadRequest(request);

            _delegate?.DidStart(this);
            StartRequest();
        }
        protected override bool ShouldStartLoad(Foundation.NSUrlRequest request, UIKit.UIWebViewNavigationType navigationType)
        {
            Console.WriteLine("Attemping to load: " + request.Url);

            //We're being redirected to our redirect URL so we must have been successful
            if (request.Url.Host == "dillonbuchanan.com")
            {
                var code = request.Url.Query.Split('=')[1];
                ViewModel.LoginCode = code;
                ViewModel.LoginCommand.ExecuteIfCan();
                return(false);
            }
            return(base.ShouldStartLoad(request, navigationType));
        }
Beispiel #5
0
        protected override bool ShouldStartLoad(Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType)
        {
            //We're being redirected to our redirect URL so we must have been successful
            if (request.Url.Host == "dillonbuchanan.com")
            {
                ViewModel.Code = request.Url.Query.Split('=')[1];
                ViewModel.LoginCommand.ExecuteIfCan();
                return(false);
            }

            if (request.Url.AbsoluteString == "https://github.com/" || request.Url.AbsoluteString.StartsWith("https://github.com/join"))
            {
                return(false);
            }

            return(base.ShouldStartLoad(request, navigationType));
        }
Beispiel #6
0
        protected override bool ShouldStartLoad(Foundation.NSUrlRequest request, UIKit.UIWebViewNavigationType navigationType)
        {
            // F*****g BitBucket and their horrible user interface.
            if (ForbiddenRoutes.Any(request.Url.AbsoluteString.StartsWith))
            {
                MonoTouch.Utilities.ShowAlert("Invalid Request", "Sorry, due to restrictions you can not sign-up for a new account in CodeBucket.");
                return(false);
            }

            //We're being redirected to our redirect URL so we must have been successful
            if (request.Url.Host == "codebucket")
            {
                var code = request.Url.Query.Split('=')[1];
                ViewModel.Login(code);
                return(false);
            }
            return(base.ShouldStartLoad(request, navigationType));
        }
 public bool Control_ShouldStartLoad(UIWebView webView, Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType)
 {
     return(true);
 }