Exemplo n.º 1
0
        private async Task <bool> LoginStart()
        {
            DependencyService.Get <IWebCacheHelper>().ClearCookies();
            var res = await PGService.GetHpIdRedirectLink();

            if (res.Item1 && res.Item2)
            {
                var urldata       = UrlParser.Parse(res.Item3);
                var webViewerView = new WebViewerView(
                    BrowserType.NewLogin,
                    this);
                webViewerView.Uri    = urldata.AbsoluteUrl;
                App.Current.MainPage = new ContainerPage(webViewerView);
                webViewerView.GoHome();
                webViewerView.Title = "";
                return(true);
            }

            var msg = res.Item3;

            if (string.IsNullOrWhiteSpace(msg))
            {
                msg = "Unknown error";
            }
            await App.Current.MainPage.DisplayAlert("Error", msg, "Close");

            return(false);
        }
Exemplo n.º 2
0
        public void ShowBrowser(string title, string url, BrowserType type = BrowserType.Cached, bool hideTitle = false)
        {
            if (string.IsNullOrEmpty(url))
            {
                return;
            }
            var urldata = UrlParser.Parse(url);

            if (string.IsNullOrEmpty(urldata.AbsoluteUrl) || !PGService.CheckConnection(true))
            {
                return;
            }

            if (browser == null)
            {
                browser = new WebViewerView(type, this, true, true, showTitlePanel: !hideTitle);
                browser.WidthRequest  = Bounds.Width;
                browser.HeightRequest = Bounds.Height;
                browser.OnReturn     += BrowserOnReturn;
            }
            browser.Uri = urldata.AbsoluteUrl;
            browser.GoHome();
            browser.Title       = title;
            browser.IsVisible   = true;
            GridLogin.IsVisible = false;
            SLContent.Children.Add(browser);
        }