private void PrintFaxes(IJobContext context, Operation operation) { if (!context.Parameters.ContainsKey("ArchivedFilePath") || !context.Parameters.ContainsKey("ImagePath")) { Logger.Instance.LogFormat(LogType.Trace, this, Resources.NoPrintingPossible); return; } FileInfo sourceImageFile = new FileInfo((string)context.Parameters["ImagePath"]); if (!sourceImageFile.Exists) { Logger.Instance.LogFormat(LogType.Error, this, Resources.FileNotFound, sourceImageFile.FullName); return; } string imagePath = (string)context.Parameters["ImagePath"]; foreach (string queueName in _settings.GetSetting("AlarmSourcePrinterJob", "PrintingQueueNames").GetStringArray()) { var queues = _settings.GetSetting(SettingKeys.PrintingQueuesConfiguration).GetValue <PrintingQueuesConfiguration>(); PrintingQueue pq = queues.GetPrintingQueue(queueName); if (pq == null || !pq.IsEnabled) { continue; } PrintFaxTask task = new PrintFaxTask(); task.ImagePath = imagePath; task.Print(pq); } }
private void PrintFaxes(IJobContext context, Operation operation) { if (!context.Parameters.ContainsKey("ArchivedFilePath") || !context.Parameters.ContainsKey("ImagePath")) { Logger.Instance.LogFormat(LogType.Trace, this, Resources.NoPrintingPossible); return; } FileInfo sourceImageFile = new FileInfo((string)context.Parameters["ImagePath"]); if (!sourceImageFile.Exists) { Logger.Instance.LogFormat(LogType.Error, this, Resources.FileNotFound, sourceImageFile.FullName); return; } string imagePath = (string)context.Parameters["ImagePath"]; foreach (string queueName in _settings.GetSetting("AlarmSourcePrinterJob", "PrintingQueueNames").GetStringArray()) { var queues = _settings.GetSetting(SettingKeys.PrintingQueuesConfiguration).GetValue<PrintingQueuesConfiguration>(); PrintingQueue pq = queues.GetPrintingQueue(queueName); if (pq == null || !pq.IsEnabled) { continue; } PrintFaxTask task = new PrintFaxTask(); task.ImagePath = imagePath; task.Print(pq); } }
private void PrintFaxes(IJobContext context, Operation operation) { if (!context.Parameters.ContainsKey("ArchivedFilePath") || !context.Parameters.ContainsKey("ImagePath")) { return; } System.IO.FileInfo sourceImageFile = new System.IO.FileInfo((string)context.Parameters["ImagePath"]); if (!sourceImageFile.Exists) { // It was removed in the meanwhile or so return; } // Grab all created files to print string imagePath = (string)context.Parameters["ImagePath"]; PrintDocument doc = new PrintDocument(); doc.DocumentName = operation.OperationNumber + Properties.Resources.DocumentNameAppendix; if (!_printingConfiguration.IsDefaultPrinter) { doc.PrinterSettings.PrinterName = _printingConfiguration.PrinterName; } // Create dedicated task to wrap the events of the PrintDocument-class PrintFaxTask task = new PrintFaxTask(); task.ImagePath = imagePath; task.Print(doc); }