public void OnChangeEmailConfirmPressed() { string newEmail = model.newEmailField.value; string confirmEmail = model.changeEmailPasswordField.value; if (model.newEmailField.defaultText == newEmail || string.IsNullOrEmpty(newEmail) || string.IsNullOrEmpty(Regex.Match(newEmail, ".+@.+[.].+").ToString())) { ModalPopupOK.Spawn("Please enter a valid email address."); } else if (model.changeEmailPasswordField.defaultText == confirmEmail || string.IsNullOrEmpty(confirmEmail) || string.IsNullOrEmpty(Regex.Match(confirmEmail, ".+@.+[.].+").ToString())) { ModalPopupOK.Spawn("Please enter a valid confirmation email address."); } else if (string.Compare(newEmail, confirmEmail) != 0) { ModalPopupOK.Spawn("Check that your email addresses match."); } else { HelperMethods.ChangeEmailRequestObject emailRequest = new HelperMethods.ChangeEmailRequestObject(); emailRequest.email = newEmail; ITTGoogleAnalytics.Instance.googleAnalytics.LogEvent(new EventHitBuilder() .SetEventCategory("Profile - Settings Screen") .SetEventAction("Click - Confirm Button Change Email Screen") .SetEventLabel("User has clicked on the confirm button from the change email screen. Email: " + model.newEmailField.value)); ITTDataCache.Instance.UpdateUserEmail(emailRequest, OnChangeEmailSuccess, OnChangeEmailFailure); } }