protected override void OnElementChanged(ElementChangedEventArgs <Page> e) { base.OnElementChanged(e); // this is a ViewGroup - so should be able to load an AXML file and FindView<> global::Android.App.Activity activity = this.Context as global::Android.App.Activity; authenticator_page = (AuthenticatorPage)base.Element; Authenticator = authenticator_page.Authenticator; Authenticator.Completed += Authentication_Completed; Authenticator.Error += Authentication_Error; global::Android.Content.Intent ui_object = Authenticator.GetUI(activity); activity.StartActivity(ui_object); return; }
protected override async void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Page> e) { try { base.OnElementChanged(e); System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer.OnElementChanged"); if (e == null) { System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: e = {null}"); } else { if (e.NewElement == null) { System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: e.NewElement = {null}"); } if (e.OldElement == null) { System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: e.OldElement = {null}"); } } if (Element == null) { System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: Element is {null}"); } else { System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: Element is " + Element); } if (Control == null) { System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: Control is {null}"); } else { System.Diagnostics.Debug.WriteLine("AuthenticatorPageRenderer: Control is " + Control); } if (Control == null) { authenticator_page = (AuthenticatorPage)base.Element; Authenticator.Completed -= Authenticator_Completed; Authenticator.Completed += Authenticator_Completed; Authenticator.Error -= Authenticator_Error; Authenticator.Error += Authenticator_Error; Uri page_uri = Authenticator.GetUI(); Microsoft.Phone.Controls.PhoneApplicationPage this_page = null; this_page.NavigationService.Navigate(page_uri); } } catch (Exception ex) { throw new Xamarin.Auth._MobileServices.AuthException("WindowsPhone OnElementChanged"); } return; }