示例#1
0
        /// <summary>
        /// Return allocated consumable units back to the
        /// <see cref="Consumable"/> in the event the
        /// <see cref="ProxyDesTaskDesTask{T}.Client"/> is canceled or the event
        /// that runs the <see cref="ProxyDesTaskDesTask{T}.Client"/> is canceled.
        /// </summary>
        /// <remarks>
        /// This method is used as a <see cref="DeferredDataCallback"/>
        /// delegate.  The delegate is allocated by the
        /// <see cref="Consumable.RemoveUnits"/> method.
        /// </remarks>
        /// <param name="evt">
        /// The <see cref="ActivationEvent"/> making the data request.
        /// </param>
        /// <returns>Always returns <see langword="null"/>.</returns>
        internal object ReturnUnits(ActivationEvent evt)
        {
            if (!evt.IsPending)
            {
                Blocker.AddUnits(_quantity);
            }

            return(null);
        }
示例#2
0
 /// <summary>
 /// Resupply a <see cref="Consumable"/> on behalf of some client
 /// <see cref="DesTask"/>.
 /// </summary>
 /// <param name="activator">Not used.</param>
 /// <param name="data">Not used.</param>
 protected override void ExecuteTask(object activator, object data)
 {
     Blocker.AddUnits(Quantity);
     ResumeAll(Blocker, null);
 }