protected override void OnElementChanged(ElementChangedEventArgs <Page> e) { base.OnElementChanged(e); var activity = this.Context as Activity; if (showlogin && FacebookAuth.User == null) { showlogin = false; var loginPage = Element as ProviderLoginPage; var auth = GetAuthenticator(); auth.Completed += async(sender, eventArgs) => { if (eventArgs.IsAuthenticated) { var request = GetRequest(); request.Account = eventArgs.Account; var fbReponse = await request.GetResponseAsync(); FacebookAuth.SetUser(fbReponse.GetResponseText()); } else { } }; activity.StartActivity(auth.GetUI(activity)); } }
protected override void OnElementChanged(VisualElementChangedEventArgs e) { base.OnElementChanged(e); if (showLogin && FacebookAuth.User == null) { showLogin = false; var loginPage = Element as ProviderLoginPage; string providername = loginPage.ProviderName; var auth = GetAuthenticator(providername); auth.Completed += async(sender, eventArgs) => { DismissViewController(true, null); if (eventArgs.IsAuthenticated) { var request = GetRequest(providername); request.Account = eventArgs.Account; var fbResponse = await request.GetResponseAsync(); FacebookAuth.SetUser(providername, fbResponse.GetResponseText()); } else { // The user cancelled } }; PresentViewController(auth.GetUI(), true, null); } }
protected override void OnElementChanged(ElementChangedEventArgs <Page> e) { base.OnElementChanged(e); if (showLogin && FacebookAuth.User == null) { showLogin = false; var loginPage = Element as ProviderLoginPage; string providername = loginPage.ProviderName; WindowsPage windowsPage = new WindowsPage(); var auth = GetAuthenticator(providername); _frame = windowsPage.Frame; if (_frame == null) { _frame = new Windows.UI.Xaml.Controls.Frame(); //_frame.Language = global::Windows.Globalization.ApplicationLanguages.Languages[0]; windowsPage.Content = _frame; SetNativeControl(windowsPage); } auth.Completed += async(sender, eventArgs) => { if (eventArgs.IsAuthenticated) { var request = GetRequest(providername); request.Account = eventArgs.Account; var fbResponse = await request.GetResponseAsync(); FacebookAuth.SetUser(providername, fbResponse.GetResponseText()); } else { // The user cancelled } }; _frame.Navigate(auth.GetUI(), auth); Window.Current.Activate(); } }