private void ProcessJobNotification(JobNotification jobNotification) { JobNotificationTypeEnum notificationType = jobNotification.NotificationType; String jobName = jobNotification.JobName; SpooledJob spooledJob = spoolMonitor.FindSpooledJob(jobName); ManagedPrintJob managedJob = null; if (spooledJob != null) { managedJob = new ManagedPrintJob(jobName); } if (notificationType == JobNotificationTypeEnum.JobCreated) { //if (!managedJob.IsPaused()) // managedJob.Pause(); } if (notificationType == JobNotificationTypeEnum.JobChanged) { // Verifica se terminou o spooling para então processar os dados do job if (!managedJob.IsSpooling() && !spooledJob.Processed) { // spooledJob.CopyFiles(@"C:\tempSpool\" + jobName.Split(new char[] { ',' })[0]); String jobInfo = PrintJobContext.GetJobInfo(spooledJob); WriteToLog(jobInfo); spooledJob.Processed = true; } } }
public JobNotification(JobNotificationTypeEnum notificationType, String jobName) { this.NotificationType = notificationType; this.JobName = jobName; }