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); authenticator = ((AuthenticatorPage)base.Element).Authenticator; 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) { WindowsPage windowsPage = new WindowsPage(); frame = windowsPage.Frame; if (frame == null) { frame = new Windows.UI.Xaml.Controls.Frame { Language = global::Windows.Globalization.ApplicationLanguages.Languages[0] }; frame.NavigationFailed += Frame_NavigationFailed; frame.Navigated += Frame_Navigated; frame.Navigating += Frame_Navigating; frame.NavigationStopped += Frame_NavigationStopped; windowsPage.Content = frame; SetNativeControl(windowsPage); } authenticator.Completed -= Authenticator_Completed; authenticator.Completed += Authenticator_Completed; authenticator.Error -= Authenticator_Error; authenticator.Error += Authenticator_Error; Type pageType = authenticator.GetUI(); frame.Navigate(pageType, authenticator); Windows.UI.Xaml.Window.Current.Activate(); } } catch (Exception ex) { throw new Xamarin.Auth.AuthException("UWP OnElementChanged"); } 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.AuthException("WindowsPhone OnElementChanged"); } return; }