/// <summary> /// Executes all associated Batch objects. /// </summary> /// <param name="cancel">The cancellation token.</param> /// <param name="progress">The progress.</param> public void Execute(CancellationToken cancel, IProgress <ExecutionProgress> progress) { OnExecuting(new ExecutableEventArgs(this)); progress?.Report(new ExecutionProgress(NotificationType.Information, string.Format("Executing {0}", Name))); for (int batchIndex = 0; batchIndex < Batches.Count; batchIndex++) { try { Batch batch = Batches[batchIndex]; batch.Execute(cancel, progress); cancel.ThrowIfCancellationRequested(); } catch (OperationCanceledException) { throw; } catch (Exception ex) { if (ContinuteOnError) { progress?.Report(new ExecutionProgress(NotificationType.Warning, ex.Message)); } else { throw; } } } //progress?.Report(new ExecutionProgress(NotificationType.Information, string.Format("Successfully executed {0}", Name))); OnExecuted(new ExecutableEventArgs(this)); }