Example #1
0
        protected override async Task <bool> ValidateAsync(string columnName)
        {
            switch (columnName)
            {
            case nameof(UserEmail):
                if (!ShowEmail)
                {
                    return(true);
                }
                if (!UserEmail.IsValidEmailOrEmpty())
                {
                    ValidationError = (int)ViewModel.ValidationError.InvalidEmail;
                    return(false);
                }
                return(true);

            case nameof(PasswordText):
                return(await ValidatePassphraseAsync());

            case nameof(EncryptedFileFullName):
                return(ValidatePassphraseForFile());

            case nameof(ShowPassword):
            case nameof(ShowEmail):
                return(true);

            default:
                throw new ArgumentException("Cannot validate property.", columnName);
            }
        }