/// <summary> /// Initializes the pull profile button. /// </summary> /// <param name="u">The current UserInfo object</param> /// <param name="d">The current TagRideDataStore object</param> void InitPullProfileButton(UserInfo u, TagRideDataStore d) { var button = pullProfileButton; button.Text = "Pull profile from cloud"; button.Clicked += async(sender, e) => await PullProfileButtonClicked(u, d); }
/// <summary> /// Initializes the push profile button. /// </summary> /// <param name="u">The current UserInfo object.</param> /// <param name="d">The current TagRideDataStore object.</param> void InitPushProfileButton(UserInfo u, TagRideDataStore d) { var button = pushProfileButton; button.Text = "Push profile to cloud"; button.Clicked += async(sender, e) => await d.PostUserInfo(u); }
/// <summary> /// Inits button for deleting profile and photo from cloud storage. /// </summary> /// <param name="u">UuserInfo.</param> /// <param name="d">TagRideDataStore.</param> void InitDeleteProfileButton(UserInfo u, TagRideDataStore d) { var button = deleteProfileButton; button.Text = "Delete profile and logout"; button.Clicked += async(sender, e) => { await DeleteProfileButtonClicked(u, d); }; }
/// <summary> /// Click event for deleteProfileButton. /// </summary> /// <returns>The profile button clicked.</returns> /// <param name="u">UserInfo.</param> /// <param name="d">TagRideDataStore.</param> async Task DeleteProfileButtonClicked(UserInfo u, TagRideDataStore d) { // Prompt for profile deletion bool deleteProfile = await DisplayAlert("Delete Profile", "Permanently delete profile information and photo?", "Delete", "Cancel"); if (deleteProfile) { await d.DeleteUserInfo(u); Login.LoginUtils.SetUserLoggedOut(); App.Current.UserProfileManager.ResetWithoutPush(); App.Current.ShowLogin(); } else { return; } }
/// <summary> /// Click event for Pull Profile button async. /// </summary> /// <param name="u">App.Current.UserInfo</param> /// <param name="d">App.Current.DataStore</param> async Task PullProfileButtonClicked(UserInfo u, TagRideDataStore d) { UserInfo user = await d.GetUserInfo(u.UserId); u.UpdateToMatch(user); }