コード例 #1
0
 internal override void Validate(ValidationReason validationReason)
 {
     lock (this.thisLock)
     {
         this.CurrentState = this.CurrentState.Validate(validationReason);
     }
 }
コード例 #2
0
 private void ValidationCancelled()
 {
     lock (this.thisLock)
     {
         this.CurrentState = this.CurrentState.ValidationCancelled();
     }
 }
コード例 #3
0
 private void ValidationCompleted(TValidationResult result)
 {
     lock (this.thisLock)
     {
         this.CurrentState = this.CurrentState.ValidationCompleted(result);
     }
 }
コード例 #4
0
 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();
         }
     }
 }
コード例 #5
0
        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;
        }
コード例 #6
0
        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++;
            }
        }