private static string GetErrorMessage(SignUpErrorType error)
        {
            switch (error)
            {
            case SignUpErrorType.InvalidUsername:
                return("Invalid username");

            case SignUpErrorType.InvalidPassword:
                return("Invalid password");

            case SignUpErrorType.InvalidEmail:
                return("Invalid email");

            case SignUpErrorType.DuplicateUsername:
                return("Duplicate username");

            case SignUpErrorType.DuplicateEmail:
                return("Duplicate email");

            case SignUpErrorType.PasswordAndConfirmationNotSame:
                return("Password and it's confirmation are different");

            default:
                throw new ArgumentOutOfRangeException(nameof(error), error, null);
            }
        }
Пример #2
0
        private void HandleError(SignUpErrorType errorType)
        {
            switch (errorType)
            {
            case SignUpErrorType.UsernameExists:
                usernameEditText.Error = "Username already exists";
                break;

            case SignUpErrorType.EmailExists:
                emailEditText.Error = "Email already exists";
                break;

            case SignUpErrorType.ServerError:
                _dialogService.ShowError(this);
                break;

            case SignUpErrorType.Other:
                Toast.MakeText(BaseContext, "Some of the information you entered is incorrect", ToastLength.Short);
                break;
            }
        }