/// <summary> /// When the button to use a different email is clicked, changes the email to that one /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void ButtonFixEmail_Clicked(object sender, EventArgs e) { string newEmail = this.EntryChangeEmail.Text.Trim(); OperationReturnMessage result = await Task.Run(() => ServerOperations.ChangeEmail(this.username, this.password, newEmail)); if (result == OperationReturnMessage.TrueConfirmEmail) { this.LabelTitle.Text = $"Enter the confirmation code sent to {newEmail}"; } else { this.LabelMessage.Text = $"Email could not be changed."; } }
/// <summary> /// Change the user's email in a background task. /// </summary> /// <param name="password">The current password of the account.</param> /// <param name="newEmail">The new email.</param> /// <returns></returns> private OperationReturnMessage ChangeEmail(string password, string newEmail) { Device.BeginInvokeOnMainThread(() => this.LabelChangeEmailMessage.Text = "Waiting..."); return(ServerOperations.ChangeEmail(CredentialManager.Username, password.Trim(), newEmail.Trim())); }