Exemplo n.º 1
0
        /// <summary>
        /// Method so inheriting classes may add extra internal logic during the InternalExecute stage.
        /// </summary>
        internal override void SafeInternalExecute()
        {
            var errorCollection   = ViewModel.ErrorCollection;
            var hasExistingErrors = errorCollection != null && errorCollection.Count > 0;

            Validate(_validationResults);
            CanComplete = _validationResults.IsValid;

            if (!CanComplete && hasExistingErrors)
            {
                var validationMessages = _validationResults.InternalGetValidations();

                var severity = ValidationSeverity;
                var errors   = errorCollection.Where(x => x.Severity < severity).ToList();

                CanComplete = !validationMessages.Except(errors).Any();
            }

            if (CanComplete)
            {
                base.SafeInternalExecute();
            }
        }