async void PerformLogin(object sender, System.EventArgs e) { // Check that we don't have a saved login if (AuthStorage.HasLoggedIn) { // Automatically load the credentials if we have AuthStorage.LoadSavedUserDetails(client); App.NavigateToSearchPage(); return; } // Perform the login #if __ANDROID__ App.AuthenticatedUser = await client.LoginAsync(Forms.Context, MobileServiceAuthenticationProvider.Facebook); #elif __IOS__ App.AuthenticatedUser = await client.LoginAsync(UIApplication.SharedApplication.KeyWindow.RootViewController, MobileServiceAuthenticationProvider.Facebook); #endif // Save if we logged in if (App.AuthenticatedUser != null) { AuthStorage.SaveUserDetails(); App.NavigateToSearchPage(); } }
public App() { InitializeComponent(); client = new MobileServiceClient(MobileServiceClientConstants.MyFavSpotAzureUrl); Data = new AzureSqlSpotsDataService(client); // Lets start with the Data Aspects of the App if (AuthStorage.HasLoggedIn) { // Automatically load the credentials if we have them AuthStorage.LoadSavedUserDetails(client); App.NavigateToSearchPage(); } else { App.NavigateToSigninPage(); MainPage = new SigninPage(client); } }