/// <summary> /// Handler for the page's back key events. We use this to determine whether navigations /// away from this page are benign (such as going to the start screen) or actually meant /// to cancel the operation. /// </summary> void LoginPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e) { responseData = ""; responseStatus = PhoneAuthenticationStatus.UserCancel; authenticationFinished = true; }
/// <summary> /// Handler for the browser control's navigating event. We use this to detect when login /// has completed. /// </summary> private void BrowserControl_Navigating(object sender, NavigatingEventArgs e) { ShowProgressBar(); if (EqualsWithoutQueryString(e.Uri, Broker.EndUri)) { if (e.Uri.Query.StartsWith("?error")) { responseStatus = PhoneAuthenticationStatus.ErrorServer; responseErrorDetail = NoDetailsAvailableMessage; var match = Regex.Match(e.Uri.Query, @"\?error=([^&]+)&error_description=([^&]+).*", RegexOptions.None); if (match.Success) { responseErrorDetail = string.Format("Error: {0}. Description: {1}", HttpUtility.UrlDecode(match.Groups[1].Value), HttpUtility.UrlDecode(match.Groups[2].Value)); } } else { responseData = e.Uri.ToString(); responseStatus = PhoneAuthenticationStatus.Success; } authenticationFinished = true; // Navigate back now. this.NavigateBackWithProgress(); } }
internal void OnAuthenticationFinished(string data, PhoneAuthenticationStatus status, uint error) { this.responseData = data; this.responseStatus = status; this.responseErrorDetail = error; this.AuthenticationInProgress = false; // Signal the waiting task that the authentication operation has finished. authenticateFinishedEvent.Set(); }
/// <summary> /// Handler for the page's back key events. We use this to determine whether navigations /// away from this page are benign (such as going to the start screen) or actually meant /// to cancel the operation. /// </summary> private void LoginPage_BackKeyPress(object sender, BackPressedEventArgs e) { UnhookEvents(); responseData = ""; responseStatus = PhoneAuthenticationStatus.UserCancel; authenticationFinished = true; e.Handled = true; NavigateBackWithProgress(); }
/// <summary> /// Handler for the browser control's navigation failed event. We use this to detect errors /// </summary> private void BrowserControl_NavigationFailed(object sender, WebViewNavigationFailedEventArgs e) { UnhookEvents(); // Pass along the provided error information. responseErrorDetail = string.Format("Error: {0}", e.WebErrorStatus); responseStatus = PhoneAuthenticationStatus.ErrorHttp; authenticationFinished = true; // Navigate back now. this.NavigateBackWithProgress(); }
/// <summary> /// Handler for the browser control's navigating event. We use this to detect when login /// has completed. /// </summary> private void BrowserControl_Navigating(object sender, NavigatingEventArgs e) { if (e.Uri == Broker.EndUri) { responseData = e.Uri.ToString(); responseStatus = PhoneAuthenticationStatus.Success; authenticationFinished = true; // Navigate back now. ShowProgressBar(); NavigationService.GoBack(); } }
/// <summary> /// Handler for the browser control's navigating event. We use this to detect when login /// has completed. /// </summary> private void BrowserControl_Navigating(object sender, NavigatingEventArgs e) { if (e.Uri == PhoneWebAuthenticationBroker.EndUri) { responseData = e.Uri.ToString(); responseStatus = PhoneAuthenticationStatus.Success; authenticationFinished = true; // Navigate back now. browserControl.Source = new Uri("about:blank"); NavigationService.GoBack(); } }
/// <summary> /// Handler for the browser control's navigation failed event. We use this to detect errors /// </summary> private void BrowserControl_NavigationFailed(object sender, NavigationFailedEventArgs e) { var navEx = e.Exception as WebBrowserNavigationException; if (navEx != null) { // Pass along the provided error information. responseErrorDetail = string.Format("Error code: {0}", navEx.StatusCode); } else { // No error information available. responseErrorDetail = NoDetailsAvailableMessage; } responseStatus = PhoneAuthenticationStatus.ErrorHttp; authenticationFinished = true; e.Handled = true; // Navigate back now. this.NavigateBackWithProgress(); }
/// <summary> /// Handler for the browser control's navigation failed event. We use this to detect errors /// </summary> private void BrowserControl_NavigationFailed(object sender, NavigationFailedEventArgs e) { WebBrowserNavigationException navEx = e.Exception as WebBrowserNavigationException; if (navEx != null) { // Pass along the provided error information. responseErrorDetail = (uint)navEx.StatusCode; } else { // No error information available. responseErrorDetail = 0; } responseStatus = PhoneAuthenticationStatus.ErrorHttp; authenticationFinished = true; e.Handled = true; // Navigate back now. browserControl.Source = new Uri("about:blank"); NavigationService.GoBack(); }
public PhoneAuthenticationResponse(string data, PhoneAuthenticationStatus status, uint error) { ResponseData = data; ResponseStatus = status; ResponseErrorDetail = error; }
/// <summary> /// Handler for the browser control's navigation failed event. We use this to detect errors /// </summary> private void BrowserControl_NavigationFailed(object sender, NavigationFailedEventArgs e) { UnhookEvents(); WebBrowserNavigationException navEx = e.Exception as WebBrowserNavigationException; if (navEx != null) { // Pass along the provided error information. responseErrorDetail = string.Format("Error code: {0}", navEx.StatusCode); } else { // No error information available. responseErrorDetail = NoDetailsAvailableMessage; } responseStatus = PhoneAuthenticationStatus.ErrorHttp; authenticationFinished = true; e.Handled = true; // Navigate back now. this.NavigateBackWithProgress(); }
/// <summary> /// Handler for the browser control's navigating event. We use this to detect when login /// has completed. /// </summary> private void BrowserControl_Navigating(object sender, NavigatingEventArgs e) { if (EqualsWithoutQueryString(e.Uri, Broker.EndUri)) { if (e.Uri.Query.StartsWith("?error")) { responseStatus = PhoneAuthenticationStatus.ErrorServer; responseErrorDetail = NoDetailsAvailableMessage; var match = Regex.Match(e.Uri.Query, @"\?error=([^&]+)&error_description=([^&]+).*", RegexOptions.None); if (match.Success) { responseErrorDetail = string.Format("Error: {0}. Description: {1}", HttpUtility.UrlDecode(match.Groups[1].Value), HttpUtility.UrlDecode(match.Groups[2].Value)); } } else { responseData = e.Uri.ToString(); responseStatus = PhoneAuthenticationStatus.Success; } authenticationFinished = true; UnhookEvents(); // Navigate back now. this.NavigateBackWithProgress(); } }
/// <summary> /// Handler for the page's back key events. We use this to determine whether navigations /// away from this page are benign (such as going to the start screen) or actually meant /// to cancel the operation. /// </summary> void LoginPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e) { UnhookEvents(); ShowProgressBar(); responseData = ""; responseStatus = PhoneAuthenticationStatus.UserCancel; authenticationFinished = true; }
/// <summary> /// Handler for the browser control's navigation failed event. We use this to detect errors /// </summary> private void BrowserControl_NavigationFailed(object sender, NavigationFailedEventArgs e) { WebBrowserNavigationException navEx = e.Exception as WebBrowserNavigationException; if (navEx != null) { // Pass along the provided error information. responseErrorDetail = (uint)navEx.StatusCode; } else { // No error information available. responseErrorDetail = 0; } responseStatus = PhoneAuthenticationStatus.ErrorHttp; authenticationFinished = true; e.Handled = true; // Navigate back now. ShowProgressBar(); NavigationService.GoBack(); }
public static void OnAuthenticationFinished(string data, PhoneAuthenticationStatus status, uint error) { PhoneWebAuthenticationBroker.responseData = data; PhoneWebAuthenticationBroker.responseStatus = status; PhoneWebAuthenticationBroker.responseErrorDetail = error; PhoneWebAuthenticationBroker.AuthenticationInProgress = false; // Signal the waiting task that the authentication operation has finished. authenticateFinishedEvent.Set(); }