public async Task <SocialAccount> Login() { _isComplite = false; OAuth2Authenticator _oAuth2 = SocialNetworkAuthenticators.FacebookAuth; _oAuth2.Completed += async(sender, args) => { _account = await SocialNetworkAuthenticators.OnCompliteFacebookAuth(args); _isComplite = true; }; _oAuth2.Error += (sender, args) => OnError?.Invoke(args.Message); using (var window = new UIWindow(UIScreen.MainScreen.Bounds)) { window.RootViewController = (UIViewController)_oAuth2.GetUI(); window.MakeKeyAndVisible(); return(await Task.Run(() => { while (!_isComplite) { Task.Delay(100); } return _account; })); } }
public async Task <SocialAccount> Login() { _oAuth2 = SocialNetworkAuthenticators.FacebookAuth; _authUi = (Intent)_oAuth2.GetUI(MainActivity.Activity); MainActivity.Activity.StartActivity(_authUi); _oAuth2.Completed += async(sender, args) => { _account = await SocialNetworkAuthenticators.OnCompliteFacebookAuth(args); _isComplite = true; }; _oAuth2.Error += (sender, args) => OnError?.Invoke(args.Message); await Task.Run(() => { while (!_isComplite) { Task.Delay(100); } _authUi.Dispose(); }); return(_account); }