MvvmValidation.Internal.ValidationRule.EvaluateAsync C# (CSharp) Method

EvaluateAsync() public method

public EvaluateAsync ( ) : Task
return Task
        public Task<RuleResult> EvaluateAsync()
        {
            return AsyncValidateAction();
        }

Usage Example

コード例 #1
0
        private async Task<bool> ExecuteRuleAsync(ValidationRule rule, ISet<object> failedTargets, ValidationResult validationResultAccumulator, SynchronizationContext syncContext)
        {
            // Skip rule if the target is already invalid and the rule is not configured to execute anyway
            if (failedTargets.Contains(rule.Target) && !ShouldExecuteOnAlreadyInvalidTarget(rule))
            {
                // Assume that the rule is valid at this point because we are not interested in this error until
                // previous rule is fixed.
                SaveRuleValidationResultAndNotifyIfNeeded(rule, RuleResult.Valid(), syncContext);

                return true;
            }

            var ruleResult = !rule.SupportsSyncValidation
                ? await rule.EvaluateAsync().ConfigureAwait(false)
                : rule.Evaluate();

            SaveRuleValidationResultAndNotifyIfNeeded(rule, ruleResult, syncContext);

            AddErrorsFromRuleResult(validationResultAccumulator, rule, ruleResult);

            if (!ruleResult.IsValid)
            {
                failedTargets.Add(rule.Target);
            }

            return true;
        }
All Usage Examples Of MvvmValidation.Internal.ValidationRule::EvaluateAsync