/// <summary> /// ProgressReporter (Thread safe progress reporter) /// </summary> /// <param name="completionState">Associated state object which implements ICompletionState</param> /// <param name="defaultRequestKey">Optional IRequestKey object which can be attached to the progress object</param> /// <param name="setTotalCallback">Optional callback executed after setting value of the Total property</param> /// <param name="reportProgressCallback">Optional callback executed after setting value of the Total property</param> public ProgressReporter(ICompletionState completionState, IRequestKey defaultRequestKey, Action <IProgress> setTotalCallback = null, Action <IProgress> reportProgressCallback = null) { LinkTo(completionState); DefaultRequestKey = defaultRequestKey; SetTotalCallback = setTotalCallback; ReportProgressCallback = reportProgressCallback; }
public NsbProgressReporter(ISendOnlyBus bus, ICompletionState completionState, IRequestKey defaultRequestKey, Action <IProgress> setTotalCallback = null, Action <IProgress> reportProgressCallback = null) : base(completionState, defaultRequestKey, x => { setTotalCallback?.Invoke(x); using (new TransactionScope(TransactionScopeOption.Suppress)) { bus.Publish(x); } }, x => { reportProgressCallback?.Invoke(x); using (new TransactionScope(TransactionScopeOption.Suppress)) { bus.Publish(x); } }) { }
public void LinkTo(ICompletionState completionState) { CompletionState = completionState; }