private async void loginButton_Clicked(object sender, EventArgs e) { if (!Settings.CheckAllConfigure()) { await DisplayAlert("Configuration", "Please go to settings page and configure, then Sigin In again.", "OK"); return; } try { using (var scope = new ActivityIndicatorScope(activityIndicator, activityIndicatorPanel, true)) { AuthenticationContext ac = new AuthenticationContext(Settings.Authority); AuthenticationResult ar = await ac.AcquireTokenAsync(Settings.Resource, Settings.ClientID, new Uri(Settings.ReplyURL), App.PlatformParameters); string token = ar.AccessToken; Utils.TraceStatus("Login Success"); await Navigation.PushAsync(new MainPage(ar.UserInfo.DisplayableId, ac)); } } catch (Exception ex) { await DisplayAlert("An error has occurred", "Exception message: " + ex.Message, "Dismiss"); } }
public MainPage(string userid, AuthenticationContext ac) { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); InitClaimList(); listView.ItemTapped += async(s, e) => { listView.SelectedItem = null;//clear android select color ClaimViewModel vmodel = (ClaimViewModel)e.Item; if (vmodel.Status == ClaimStatus.Pending && userid.Length > 0) { using (var scope = new ActivityIndicatorScope(activityIndicator, activityIndicatorPanel, true)) { string imageUrl = await Helpers.GetUserClaimURL(userid); if (imageUrl != null) { vmodel.ImageUrl = imageUrl; } } } await Navigation.PushAsync(new ClaimDetailPage(vmodel)); }; authenticationContext = ac; InitGridView(); }