/**
         * Creates a new {@link ProgressEventDispatcher} and dispatches a new {@link ProgressEvent} with
         * progress 0 for {@code allocation}.
         *
         * @param eventHandlers the {@link EventHandlers}
         * @param allocation the {@link Allocation} to manage
         * @return a new {@link ProgressEventDispatcher}
         */
        private static ProgressEventDispatcher NewProgressEventDispatcher(
            IEventHandlers eventHandlers, Allocation allocation)
        {
            ProgressEventDispatcher progressEventDispatcher =
                new ProgressEventDispatcher(eventHandlers, allocation);

            progressEventDispatcher.DispatchProgress(0);
            return(progressEventDispatcher);
        }
Example #2
0
 public void SetProgressTarget(long allocationUnits)
 {
     if (progressEventDispatcher != null)
     {
         throw new InvalidOperationException(Resources.ThrottledProgressEventDispatcherWrapperResetExceptionMessage);
     }
     progressEventDispatcher = progressEventDispatcherFactory.Create(description, allocationUnits);
     throttledDispatcher     =
         new ThrottledAccumulatingConsumer(progressEventDispatcher.DispatchProgress);
 }