예제 #1
0
        public void UpdateValidationMessage()
        {
            var newValidationResults = Validate();

            if (ValidationResults.SequenceEqual(newValidationResults))
            {
                return;
            }

            ValidationResults.Clear();
            ValidationResults.AddRange(newValidationResults);
            TriggerEvent(new ValidationChangedEvent(DateTime.Now, Name, ValidationMessages));
        }
        /// <summary>
        /// Prüft das Eingabeelement auf Korrektheit der Daten
        /// </summary>
        public virtual void Validate()
        {
            IsValidated = true;

            if (!Disabled)
            {
                var args = new ValidationEventArgs()
                {
                    Value = Value
                };
                OnValidation(args);

                ValidationResults.AddRange(args.Results);
            }
        }
        private void Run()
        {
            ValidationResults.Clear();

            var configuration = ConfigurationHelper.Load(ConfigFilePath);
            var ruleProcessor = new RuleProcessor(ProjectFileLocation, configuration, IsReformatEnabled);

            _isRuleEngineWorking = true;

            Task.Factory.StartNew(() => ruleProcessor.Process(validationResult =>
            {
                if (System.Windows.Application.Current.Dispatcher.CheckAccess())
                {
                    ValidationResults.AddRange(validationResult.Messages.Where(vm => !vm.Processed));
                }
                else
                {
                    System.Windows.Application.Current.Dispatcher.Invoke(() => ValidationResults.AddRange(validationResult.Messages.Where(vm => !vm.Processed)));
                }
            })).ContinueWith(t => _isRuleEngineWorking = false);
        }
예제 #4
0
 public ValidationFailedException(List <ValidationResult> validationResults) : base(
         $"Validation Failed. Errors:{ListErrors(validationResults)}")
 {
     ValidationResults.AddRange(validationResults);
 }
예제 #5
0
 public void AddActionResult(IActionResult actionResult)
 {
     ActionResults.Add(actionResult);
     ValidationResults.AddRange(actionResult.ValidationResults);
     CommandResults.Add(actionResult.CommandResult);
 }