internal override void Validate(ValidationReason validationReason) { lock (this.thisLock) { this.CurrentState = this.CurrentState.Validate(validationReason); } }
private void ValidationCancelled() { lock (this.thisLock) { this.CurrentState = this.CurrentState.ValidationCancelled(); } }
private void ValidationCompleted(TValidationResult result) { lock (this.thisLock) { this.CurrentState = this.CurrentState.ValidationCompleted(result); } }
internal override void ActivateValidation() { lock (this.thisLock) { this.deactivationReferenceCount--; Fx.Assert(this.deactivationReferenceCount >= 0, "It should never happen -- deactivationReferenceCount < 0."); if (this.deactivationReferenceCount == 0) { this.CurrentState = this.CurrentState.ActivateValidation(); } } }
internal BackgroundValidationSynchronizer(TaskDispatcher dispatcher, Func <ValidationReason, CancellationToken, TValidationResult> validationWork, Action <TValidationResult> updateWork) { Fx.Assert(validationWork != null, "validationWork should not be null and is ensured by caller."); Fx.Assert(updateWork != null, "updateWork should not be null and is ensured by caller."); this.Idle = new IdleState(this); this.Validating = new ValidatingState(this); this.CancellingForNextValidation = new CancellingForNextValidationState(this); this.CancellingForDeactivation = new CancellingForDeactivationState(this); this.ValidationDeactivated = new ValidationDeactivatedState(this); this.dispatcher = dispatcher; this.validationWork = validationWork; this.updateWork = updateWork; this.currentState = this.Idle; }
internal override void DeactivateValidation() { lock (this.thisLock) { Fx.Assert(this.deactivationReferenceCount >= 0, "It should never happen -- deactivationReferenceCount < 0."); if (this.deactivationReferenceCount == 0) { this.CurrentState = this.CurrentState.DeactivateValidation(); if (this.CurrentState != this.ValidationDeactivated) { Monitor.Wait(this.thisLock); } } this.deactivationReferenceCount++; } }