private void EnqueueRevalidation(RevalidationRequest target) { if (!_currentlyValidating.Contains(target)) { _validationQueue.Enqueue(target); } }
public void Enqueue(RevalidationRequest request) { if (_set.Contains(request)) { return; } _set.Add(request); _queue.Enqueue(request); }
public void ManuallyEndValidation( IViewModel target, IVMPropertyDescriptor targetProperty ) { var equivalentRequest = new RevalidationRequest(target, targetProperty); _currentlyValidating.Remove(equivalentRequest); IBehaviorContext context = target.Kernel.GetContext(); targetProperty.Behaviors.EndValidationNext(context); }
public void ProcessPendingValidations() { while (_validationQueue.HasRequests) { // We dequeue the request after the revalidation to avoid that the same // request that is currently processed is added to the queue again. RevalidationRequest r = _validationQueue.Peek(); r.PerformRevalidation(this); _validationQueue.Dequeue(); } }
private CollectionResult ValidateCollectionIfNotInCache(ICollectionValidationTarget target) { CollectionResult cachedResult = _cachedCollectionResults .FirstOrDefault(cached => target.Equals(cached.Target)); if (cachedResult == null) { cachedResult = CollectionValidationController.Validate(target); _cachedCollectionResults.Add(cachedResult); foreach (IViewModel item in cachedResult.PossiblyStaleItems) { var r = new RevalidationRequest(item, target.Property); EnqueueRevalidation(r); } } return(cachedResult); }