private void webView_Navigated(object sender, WebNavigatedEventArgs e) { Debug.WriteLine("navigated" + navigatingUrl + "/" + e.Result); if (e.Result == WebNavigationResult.Success) { } else if (e.Result == WebNavigationResult.Failure) { Debug.WriteLine("FAILURE"); string goUrl = navigatingUrl == "" ? e.Url : navigatingUrl; if (goUrl.IndexOf("intent://", StringComparison.Ordinal) == 0) { goUrl = goUrl.Replace("intent://", "naverplayer://"); } if (goUrl.IndexOf(NAVERPLAYER_SCHEME, StringComparison.Ordinal) == 0) { DependencyService.Get <IAppHandler>().LaunchApp(goUrl); } } webView.Navigating += webView_Navigating; webView.Navigated -= webView_Navigated; IsBusy = false; navigatingUrl = ""; OnChangedWebViewCanMoveStatus(); }
private async void WebViewOnNavigated(object sender, WebNavigatedEventArgs e) { var accessToken = ExtractAccessTokenFromUrl(e.Url); if (accessToken != "") { var facebookServices = new FacebookServices(); var facebookProfile = await facebookServices.GetFacebookProfileAsync(accessToken); Settings.FacebookId = facebookProfile.Id; string[] arr = new string[] { }; User user = new User { Facebookid = facebookProfile.Id, Fname = facebookProfile.FirstName, Lname = facebookProfile.LastName, Imgurl = facebookProfile.Picture.Data.Url, Description = string.Empty, Range = 0, Zipcode = string.Empty }; var favorService = new FavorService(); bool check = await favorService.CheckUserAsync(facebookProfile.Id); if (check == true) { favorService.CreateUserAsync(user); } await Navigation.PopToRootAsync(); } }
public async Task OnNavigate(WebView sender, WebNavigatedEventArgs args) { // Returns if not result URL string targetFqdn = _targetInstance.Replace("http://", "").Replace("http://", ""); if (!args.Url.StartsWith($"http://{targetFqdn}") && !args.Url.StartsWith($"https://{targetFqdn}")) { return; } // Retrieves token and sets it to a new client string pageHTML = await sender.EvaluateJavaScriptAsync("document.documentElement.outerHTML").ConfigureAwait(false); string response = pageHTML .Replace("\\u003Chtml>\\u003Chead>\\u003C/head>\\u003Cbody>\\u003Cpre style=\\\"word-wrap: break-word; white-space: pre-wrap;\\\">", "") .Replace("\\u003C/pre>\\u003C/body>\\u003C/html>", ""); // Retrieves server URLs and adds instance Result <ServerURLs> serverUrLs = await SimpleForumClient.GetServerURLs(_targetInstance).ConfigureAwait(false); if (!this.HandleResult(serverUrLs)) { return; } SimpleForumClient client = new SimpleForumClient(serverUrLs.Value.APIURL); client.TokenStorage.SetToken(response); Instance instance = new Instance(serverUrLs.Value, client); await _account.AddInstance(instance); // Closes webview MainThread.BeginInvokeOnMainThread(async() => await Application.Current.MainPage.Navigation.PopAsync()); }
private async void WebView_OnNavigated(object sender, WebNavigatedEventArgs e) { switch (e.Result) { case WebNavigationResult.Success: if (e.Url.Contains("code=")) { var myUri = new Uri(e.Url); var authCode = myUri.ExtractQueryValue("code"); await this.RequestAuthorizationAsync(authCode); } else if (e.Url.Contains("lc=")) { // Redirect to signin page if there's a bounce this._webView.Source = _signInUrl; } break; case WebNavigationResult.Failure: break; case WebNavigationResult.Timeout: break; case WebNavigationResult.Cancel: break; default: break; } }
private async void WebViewOnNavigated(object sender, WebNavigatedEventArgs e) { var accessToken = ExtractAccessTokenFromUrl(e.Url); if (accessToken != "") { var vm = BindingContext as FacebookViewModel; await vm.SetFacebookUserProfileAsync(accessToken); Content = MainStackLayout; Database.SetFacebookProfile(vm.FacebookProfile); await Database.LoadTeamData(); await Navigation.PushAsync(new Loading()); // If user exists in database load and send user direktly to app if (await Database.CheckIfUserExist(vm.FacebookProfile.Id)) { await Database.GetUserData(vm.FacebookProfile.Id); await Navigation.PopAsync(); await Navigation.PushAsync(new MainTabbed()); await HomePage.LoadPerformanceData(); } else { await Navigation.PushAsync(new ChooseCoachOrPlayerPage()); } } // Send to chose athlete or coach }
private async void TheWebView_Navigated(object sender, WebNavigatedEventArgs e) { await theWebView.EvaluateJavaScriptAsync(applyValuesJS); int sleepCount = 0; bool passed = false; do { valueCheck = await theWebView.EvaluateJavaScriptAsync("javascript:document.getElementById('textfield_1').value"); if (passed == true) { Thread.Sleep(5000); sleepCount += 1; } passed = true; }while (String.IsNullOrWhiteSpace(valueCheck) && sleepCount <= 0); if (!String.IsNullOrWhiteSpace(valueCheck)) { Debug.WriteLine("JavaScript Value Is Not Null or White Space: " + valueCheck); //await theWebView.EvaluateJavaScriptAsync(submitValuesJS); Thread.Sleep(1000); ActivityIndicatorActive(false); Complete_Layout.IsVisible = true; return; } else { ActivityIndicatorActive(false); Failed_Layout.IsVisible = true; } }
private void webOnEndNavigating(object sender, WebNavigatedEventArgs e) { isActiveWindow = false; ProgressBarNavigating.IsVisible = false; TimerCallback(); ProgressBarNavigating.Progress = 0; }
/// <summary> /// Remvoe the header and footer from the content. /// End the progress bar /// </summary> void webOnEndNavigating(object sender, WebNavigatedEventArgs e) { string js = "var x = document.getElementById('site-header').style.display = 'none';document.getElementById('footer').style.display = 'none';"; Browser.Eval(js); progress.IsVisible = false; }
private async void ArtWebView_Write_Navigated(object sender, WebNavigatedEventArgs e) { this.actLoading.Progress = .3; await this.actLoading.ProgressTo(1, 1000, Easing.Linear); this.skltLoading.IsVisible = false; }
private async void MainWebView_Navigated(object sender, WebNavigatedEventArgs e) { _webPageLoadingTimer.Stop(); _mainPageViewModel.StopLoadingButtonIsVisible = false; _mainPageViewModel.IsBusy = false; if (_functionNotWork) { await DisplayAlert("通知", "抱歉 Yahoo! 購物中心 此選項的畫面,在本 App 中會無法正確呈現。\r\n\r\nApp 將會回到上一個選項畫面...", "了解"); _functionNotWork = false; if (e.Url == "https://tw.mobi.yahoo.com/") { _mainWebView.Source = new UrlWebViewSource() { Url = "https://m.tw.buy.yahoo.com/" }; return; } _mainWebView.GoBack(); } _mainWebView.Eval(@"(function() { var hyperlinks = document.getElementsByTagName('a'); for(var i = 0; i < hyperlinks.length; i++) { hyperlinks[i].setAttribute('target', '_self'); } })()"); }
public override async void LoadingFinished(UIWebView webView) { try { Debug.WriteLine("LoadingFinished"); // Sometimes pinyin doesn't work, so delay 500ms before starting await Task.Delay(500); InjectJS(webView, "annotScan()"); var words = await StorehouseService.Instance.GetWordsAsync(); string english = string.Join(",", words.Select(w => w.English).ToArray()); string pinyin = string.Join(",", words.Select(w => w.Pinyin).ToArray()); InjectJS(webView, string.Format("injectWords('{0}', '{1}')", english, pinyin)); Debug.WriteLine("ENGLISH => " + english); Debug.WriteLine("PINYIN => " + pinyin); var url = webView.Request.Url.AbsoluteUrl.ToString(); var args = new WebNavigatedEventArgs(lastEvent, jwWebView.Source, url, WebNavigationResult.Success); Navigated(jwWebView, args); } catch (Exception e) { Debug.WriteLine("LoadingFinished Excption => " + e.Message); } }
/// <summary> /// Called when navigation to current page has finished /// </summary> /// <param name="sender">sender object</param> /// <param name="args">event args</param> private void OnNavigated_WebView(object sender, WebNavigatedEventArgs args) { if (!this.taskCompletionSourcePageLoaded.Task.IsCompleted) { this.taskCompletionSourcePageLoaded.SetResult(true); } }
private void ViewOnNavigated(object sender, WebNavigatedEventArgs e) { if (e.Url.Contains(PaymentSuccessUri)) { Application.Current.MainPage.Navigation.PopModalAsync(); } }
void webOnEndNavigating(object sender, WebNavigatedEventArgs e) { LoginButton.IsEnabled = true; if (e.Url.StartsWith("cardea://auth")) { WebView.IsVisible = false; LoginForm.IsVisible = true; var URL = new Uri(e.Url); string code = e.Url.Split(new string[] { "code=" }, System.StringSplitOptions.RemoveEmptyEntries)[1].Split('#')[0]; Dictionary <string, string> form = new Dictionary <string, string>(); form["code"] = code; form["grant_type"] = "authorization_code"; form["client_id"] = "22D7B9"; form["redirect_uri"] = "cardea://auth"; var content = new FormUrlEncodedContent(form); var client = new HttpClient(); var authheader = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("22D7B9:c501ba0677ae034ac4d64051695b1ffa"))); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("22D7B9:c501ba0677ae034ac4d64051695b1ffa"))); var result = client.PostAsync("https://api.fitbit.com/oauth2/token", content).Result; string resp = result.Content.ReadAsStringAsync().Result; var tokens = JsonConvert.DeserializeObject <AuthResp>(resp); App.auth_token = tokens.access_token; App.userid = tokens.user_id; Navigation.PushModalAsync(new HomePage()); } }
private void WebView_Navigated(object sender, WebNavigatedEventArgs e) { if (_service.CheckRedirectUrl(e.Url)) { _service.ContinueGetTokens(new Uri(e.Url)); } }
private async void WebView_Navigated(object sender, WebNavigatedEventArgs e) { //Checamos que el usuario se haya logueado bien con facebook if (e.Result == WebNavigationResult.Failure || e.Result == WebNavigationResult.Timeout) { await DisplayAlert("Error", "Facebook no tiene conexión a internet", "Ok"); await Navigation.PopAsync(); } if (e.Url.Contains("error_reason=user_denied")) { await Navigation.PopAsync(); } var accesToken = ExtractAccesTokenFromUrl(e.Url);//A partir de aqui es el puro token if (accesToken == "") { return; } //Obtenemos los datos del usuario en base al token retornado //en este punto cambiamos la vista a un "Waiting", creamos la cuenta e iniciamos sesion this.Content = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.White, Children = { actIndicator } }; actIndicator.IsRunning = true; var result = await GetFacebookProfileAsync(accesToken); }
private void Webview_Navigated(object sender, WebNavigatedEventArgs e) { if (e.Url.ToLower().Contains("payment/confirm")) { callback.Invoke(ResponseCode.OK); } }
private async void OnNavigated(object sender, WebNavigatedEventArgs e) { if (e.Result == WebNavigationResult.Failure) { new CustomPopup( LocalizedStrings.AuthNoInternetError, LocalizedStrings.Retry, OnAppearing) .Show(); return; } var url = new Uri(((UrlWebViewSource)loginWebView.Source).Url); if (AuthorizationManager.AuthorizeFromUrl(url)) { await AuthorizationManager.SetPhoto(); Navigation.InsertPageBefore(new DialogsPage(dialogsManager, messagesManager), Navigation.NavigationStack[0]); await Navigation.PopToRootAsync(); _ = longPollingManager.Start().ConfigureAwait(false); refreshingPopup?.Dismiss(); refreshingPopup = null; return; } var script = AuthorizationPageScript.Script .Replace("{PleaseWait}", LocalizedStrings.PleaseWait); loginWebView.Eval(script); refreshingPopup?.Dismiss(); refreshingPopup = null; }
internal async Task OnBrowserNavigated(object sender, WebNavigatedEventArgs e) { Loading = false; if (!(sender is WebView browser)) { throw new Exception($"Sender is not of type WebView"); } if (!Uri.TryCreate(e.Url, UriKind.Absolute, out Uri uri)) { throw new Exception($"Uri creation failed for: {e.Url}"); } if (string.IsNullOrEmpty(_options.EndUrl)) { if (uri.LocalPath.ToLowerInvariant() == "/account/logout") { _result = new BrowserResult() { ResultType = BrowserResultType.Success }; if (!_navPopped) { _navPopped = true; await PopPageModel(); } } } }
private void WebView_Navigated(object sender, WebNavigatedEventArgs e) { try { //Action onFinish = new Action(() => { Navigation.PushAsync(new Page1()); Navigation.RemovePage(this); }); Action onFinish = new Action(() => { buttonContinue.IsVisible = true; }); var thread = new Thread(async() => { await Task.Delay(30 * 1000); //wait 30 seconds before start measuring TestMeViewModel b = new TestMeViewModel(); b.Progress = 0; MeasurementHandler.GetStressResult(-1, b); while (b.IsFinished == false) { if (b.StressResult.StartsWith("Error")) { //TODO: alert user and try again return; } } //int repetitionTime = MeasurementHandler.measureRepetitionTime; //DependencyService.Get<ISchedule>().ScheduleMeasurement(repetitionTime); //Schedule measurement every 6 minutes Xamarin.Forms.Device.BeginInvokeOnMainThread(onFinish); }); thread.Start(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private async void WebView_Navigated(object sender, WebNavigatedEventArgs e) { var ewan = e.Url; var accessToken = await ExtractAccessTokenFromUrl(e.Url); //await DisplayAlert("checking pa111", accessToken, "Okay"); if (accessToken != "" || string.IsNullOrEmpty(accessToken) == false) { if (socialMedieChosen == SocialMediaPlatform.Facebook) { await getFacebookProfileAsync(accessToken); } else if (socialMedieChosen == SocialMediaPlatform.Instagram) { //await getInstagramInfo(Application.Current.Properties["Id"].ToString().Replace("\"",""), accessToken); await getInstagramProfileAsync(accessToken); } else if (socialMedieChosen == SocialMediaPlatform.Spotify) { await getSpotifyPlayList(accessToken); } else if (socialMedieChosen == SocialMediaPlatform.Google) { await getGoogleProfile(accessToken); //await DisplayAlert("Access TOKENER",accessToken,"Okay"); } } }
private void Element_Navigated(object sender, WebNavigatedEventArgs e) { if (string.IsNullOrWhiteSpace(Control.Title)) { Control.Reload(); } }
public override void LoadingFinished(UIWebView webView) { var url = webView.Request.Url.AbsoluteUrl.ToString(); var args = new WebNavigatedEventArgs(lastEvent, formsWebView.Source, url, WebNavigationResult.Success); Navigated(formsWebView, args); }
public override void OnPageFinished(WView view, string url) { if (_renderer?.Element == null || url == WebViewRenderer.AssetBaseUrl) { return; } var source = new UrlWebViewSource { Url = url }; _renderer.IgnoreSourceChanges = true; _renderer.ElementController.SetValueFromRenderer(WebView.SourceProperty, source); _renderer.IgnoreSourceChanges = false; bool navigate = _navigationResult == WebNavigationResult.Failure ? !url.Equals(_lastUrlNavigatedCancel, StringComparison.OrdinalIgnoreCase) : true; _lastUrlNavigatedCancel = _navigationResult == WebNavigationResult.Cancel ? url : null; if (navigate) { var args = new WebNavigatedEventArgs(_renderer.GetCurrentWebNavigationEvent(), source, url, _navigationResult); _renderer.ElementController.SendNavigated(args); } _renderer.UpdateCanGoBackForward(); base.OnPageFinished(view, url); }
public override void FinishedLoad(WebKit.WebView sender, WebFrame forFrame) { Renderer._sentNavigating = false; if (Renderer.Control.IsLoading) { return; } if (Renderer.Control.MainFrameUrl == $"file://{NSBundle.MainBundle.BundlePath}/") { return; } Renderer._ignoreSourceChanges = true; Renderer.Element?.SetValueFromRenderer(WebView.SourceProperty, new UrlWebViewSource { Url = Renderer.Control.MainFrameUrl }); Renderer._ignoreSourceChanges = false; Renderer._lastEvent = Renderer._lastBackForwardEvent; var args = new WebNavigatedEventArgs(Renderer._lastEvent, Renderer.Element?.Source, Renderer.Control.MainFrameUrl, WebNavigationResult.Success); Renderer.Element?.SendNavigated(args); var args2 = new WebNavigatingEventArgs(WebNavigationEvent.Forward, null, null); Renderer.Element?.SendNavigating(args2); Renderer.UpdateCanGoBackForward(); }
void webOnEndNavigating(object sender, WebNavigatedEventArgs e) { LoadingLabel.IsVisible = false; IndicatorActiviry.IsRunning = false; IndicatorActiviry.IsVisible = false; LoadingLayout.IsVisible = false; }
private void WebView_OnNavigated(object sender, WebNavigatedEventArgs e) { var eUrl = e.Url; Loading.Instance.Hide(); var findByName = webView.FindByName("objectBox objectBox-string"); }
public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation) { if (webView.IsLoading) { return; } var url = GetCurrentUrl(); if (url == $"file://{NSBundle.MainBundle.BundlePath}/") { return; } _renderer._ignoreSourceChanges = true; WebView.SetValueFromRenderer(WebView.SourceProperty, new UrlWebViewSource { Url = url }); _renderer._ignoreSourceChanges = false; var args = new WebNavigatedEventArgs(_lastEvent, WebView.Source, url, WebNavigationResult.Success); WebView.SendNavigated(args); _renderer.UpdateCanGoBackForward(); }
public void C_NavigatedUpdated(object sender, WebNavigatedEventArgs e) { if (e.Url.TrimEnd('/').EndsWith("reddit.com")) { BrowserWindow.Source = MainPage.AuthTokenRetrieverLib.AuthURL(); } }
private async void CWebView_Navigated(object sender, WebNavigatedEventArgs e) { // This regex checks if the url is a book and gets the id Match regex = new Regex(@"(\d+)[-b]*.epub").Match(e.Url); if (regex.Success) { string id = regex.Groups[1].Value; CBook book = CApi.SearchBooks(id, "id", "exact").Books[0]; ChitankaBookModel cBook = new ChitankaBookModel() { Book = book, DownloadURL = e.Url }; await Navigation.PushModalAsync(new NavigationPage(new BookDetailView(cBook))); } else { bool regexFb = new Regex(@"(\d+)[-b]*.fb2.zip").Match(e.Url).Success; bool regexTxt = new Regex(@"(\d+)[-b]*.txt.zip").Match(e.Url).Success; bool regexSfb = new Regex(@"(\d+)[-b]*.sfb.zip").Match(e.Url).Success; if (!(regexFb || regexTxt || regexSfb)) { vm.LastPage = e.Url; } } }
public override void LoadingFinished(UIWebView webView) { if (webView.IsLoading) return; _renderer._ignoreSourceChanges = true; var url = GetCurrentUrl(); ((IElementController)WebView).SetValueFromRenderer(WebView.SourceProperty, new UrlWebViewSource { Url = url }); _renderer._ignoreSourceChanges = false; var args = new WebNavigatedEventArgs(_lastEvent, WebView.Source, url, WebNavigationResult.Success); WebView.SendNavigated(args); _renderer.UpdateCanGoBackForward(); }