Пример #1
0
        public virtual void HandlePreviousStepResult(object sender, FileStoragePipelineEventArgs args)
        {
            if (args.BatchFilePaths == null)
            {
                throw new ArgumentNullException(nameof(args.BatchFilePaths));
            }

            if (!args.BatchFilePaths.Any())
            {
                throw new ArgumentException(nameof(args.BatchFilePaths), "The pathed batch contains no files.");
            }

            ServiceStateInfo.Instance.UpdateState(ServiceState.IsHandlingBatch);

            _safeExecuteManager.ExecuteWithExceptionLogging(() =>
            {
                foreach (var file in args.BatchFilePaths)
                {
                    _pdfGenerator.AddImageToDocument(file);
                }

                var outputFilePath = GetOutputPath(args.BatchFilePaths.First());
                _pdfGenerator.SavePdf(outputFilePath);

                args.FilePath = outputFilePath;

                OnStepExecuted(this, args);
            });
        }