コード例 #1
0
        private void TellMeMore()
        {
            const string url  = "https://help.github.com/articles/about-third-party-application-restrictions/";
            var          view = new WebBrowserViewController(url);

            PresentViewController(view, true, null);
        }
コード例 #2
0
        private void ShareButtonPress(UIBarButtonItem barButtonItem)
        {
            var sheet        = new UIActionSheet();
            var shareButton  = sheet.AddButton("Share");
            var showButton   = sheet.AddButton("Show in GitHub");
            var cancelButton = sheet.AddButton("Cancel");

            sheet.CancelButtonIndex = cancelButton;

            sheet.Dismissed += (sender, e) =>
            {
                BeginInvokeOnMainThread(() =>
                {
                    if (e.ButtonIndex == showButton)
                    {
                        var viewController = new WebBrowserViewController(Readme.HtmlUrl);
                        PresentViewController(viewController, true, null);
                    }
                    else if (e.ButtonIndex == shareButton)
                    {
                        AlertDialogService.Share(
                            $"{_owner}/{_repository} Readme",
                            url: Readme.HtmlUrl,
                            barButtonItem: barButtonItem);
                    }
                });

                sheet.Dispose();
            };

            sheet.ShowFrom(barButtonItem, true);
        }
コード例 #3
0
 private void TellMeMore()
 {
     const string url = "https://help.github.com/articles/about-third-party-application-restrictions/";
     var view = new WebBrowserViewController(url);
     view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Buttons.CancelButton, UIBarButtonItemStyle.Done,
         (s, e) => DismissViewController(true, null));
     PresentViewController(new ThemedNavigationController(view), true, null);
 }
コード例 #4
0
        private void ShowWebPage(string url)
        {
            var view = new WebBrowserViewController(url);

            view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Buttons.CancelButton, UIBarButtonItemStyle.Done,
                                                                        (s, e) => DismissViewController(true, null));
            PresentViewController(new ThemedNavigationController(view), true, null);
        }
コード例 #5
0
        private void TellMeMore()
        {
            const string url  = "https://help.github.com/articles/about-third-party-application-restrictions/";
            var          view = new WebBrowserViewController(url);

            view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Buttons.CancelButton, UIBarButtonItemStyle.Done,
                                                                        (s, e) => DismissViewController(true, null));
            PresentViewController(new ThemedNavigationController(view), true, null);
        }
コード例 #6
0
        protected override bool ShouldStartLoad(WebKit.WKWebView webView, WebKit.WKNavigationAction navigationAction)
        {
            if (!navigationAction.Request.Url.AbsoluteString.StartsWith("file://", StringComparison.Ordinal))
            {
                var viewController = new WebBrowserViewController(navigationAction.Request.Url.AbsoluteString);
                PresentViewController(viewController, true, null);
                return(false);
            }

            return(base.ShouldStartLoad(webView, navigationAction));
        }
コード例 #7
0
        private void ShowInBrowser()
        {
            var url = Content?.HtmlUrl;

            if (url == null)
            {
                return;
            }

            var viewController = new WebBrowserViewController(url);

            PresentViewController(viewController, true, null);
        }
コード例 #8
0
        public override bool ShouldStartLoad(WKWebView webView, WKNavigationAction navigationAction)
        {
            var url = navigationAction.Request.Url.AbsoluteString;

            if (!url.StartsWith("file://", StringComparison.Ordinal))
            {
                var webBrowser = new WebBrowserViewController(url);
                PresentViewController(webBrowser, true, null);
                return(false);
            }

            return(base.ShouldStartLoad(webView, navigationAction));
        }
コード例 #9
0
        protected virtual bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType)
        {
            var url = request.Url;

            if (url.Scheme.Equals("app"))
            {
                var func = url.Host;

                if (string.Equals(func, "buy", StringComparison.OrdinalIgnoreCase))
                {
                    // Purchase
                    Activate(_featuresService.ActivatePro).ToBackground();
                }
                else if (string.Equals(func, "restore", StringComparison.OrdinalIgnoreCase))
                {
                    // Restore
                    Activate(_featuresService.RestorePro).ToBackground();
                }

                return(false);
            }

            if (url.Scheme.Equals("mailto", StringComparison.OrdinalIgnoreCase))
            {
                UIApplication.SharedApplication.OpenUrl(url);
                return(false);
            }

            if (url.Scheme.Equals("file"))
            {
                return(true);
            }

            if (url.Scheme.Equals("http") || url.Scheme.Equals("https"))
            {
                var vm   = new WebBrowserViewModel().Init(url.AbsoluteString);
                var view = new WebBrowserViewController(true, true)
                {
                    ViewModel = vm
                };
                view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Cancel, UIBarButtonItemStyle.Done,
                                                                            (s, e) => DismissViewController(true, null));
                PresentViewController(new ThemedNavigationController(view), true, null);
                return(false);
            }

            return(false);
        }
コード例 #10
0
        protected override bool ShouldStartLoad(WebKit.WKWebView webView, WebKit.WKNavigationAction navigationAction)
        {
            var url = navigationAction.Request.Url;

            if (url.Scheme.Equals("app"))
            {
                var func = url.Host;

                if (string.Equals(func, "buy", StringComparison.OrdinalIgnoreCase))
                {
                    Activate(_featuresService.ActivatePro).ToBackground();
                }
                else if (string.Equals(func, "restore", StringComparison.OrdinalIgnoreCase))
                {
                    Activate(_featuresService.RestorePro).ToBackground();
                }

                return(false);
            }

            if (url.Scheme.Equals("mailto", StringComparison.OrdinalIgnoreCase))
            {
                UIApplication.SharedApplication.OpenUrl(url);
                return(false);
            }

            if (url.Scheme.Equals("file"))
            {
                return(true);
            }

            if (url.Scheme.Equals("http") || url.Scheme.Equals("https"))
            {
                var view = new WebBrowserViewController(url.AbsoluteString);
                view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Buttons.CancelButton, UIBarButtonItemStyle.Done,
                                                                            (s, e) => DismissViewController(true, null));
                PresentViewController(new ThemedNavigationController(view), true, null);
                return(false);
            }

            return(false);
        }
コード例 #11
0
        protected override bool ShouldStartLoad(WebKit.WKWebView webView, WebKit.WKNavigationAction navigationAction)
        {
            var url = navigationAction.Request.Url;

            if (url.Scheme.Equals("app"))
            {
                var func = url.Host;

                if (string.Equals(func, "buy", StringComparison.OrdinalIgnoreCase))
                {
                    Activate(_featuresService.ActivatePro).ToBackground();
                }
                else if (string.Equals(func, "restore", StringComparison.OrdinalIgnoreCase))
                {
                    Activate(_featuresService.RestorePro).ToBackground();
                }

                return(false);
            }

            if (url.Scheme.Equals("mailto", StringComparison.OrdinalIgnoreCase))
            {
                UIApplication.SharedApplication.OpenUrl(url);
                return(false);
            }

            if (url.Scheme.Equals("file"))
            {
                return(true);
            }

            if (url.Scheme.Equals("http") || url.Scheme.Equals("https"))
            {
                var view = new WebBrowserViewController(url.AbsoluteString);
                PresentViewController(view, true, null);
                return(false);
            }

            return(false);
        }
コード例 #12
0
        private void GoToGitHub()
        {
            var viewController = new WebBrowserViewController(CodeHubUrl);

            PresentViewController(viewController, true, null);
        }
コード例 #13
0
        private void ShowWebPage(string url)
        {
            var view = new WebBrowserViewController(url);

            PresentViewController(view, true, null);
        }