Example #1
0
        private void SpoolFileCreated(Object sender, FileSystemEventArgs e)
        {
            // todo: abrir thread (BackgroundWorker) para tratamento da ação

            SpooledJob spooledJob = new SpooledJob(e.FullPath, listener);

            if (spooledJob.ShadowFile == null)
            {
                return;
            }

            String jobName = spooledJob.ShadowFile.PrinterName + ", " + spooledJob.ShadowFile.JobId.ToString();

            if (!spool.ContainsKey(jobName))
            {
                fileMap.Add(e.FullPath, jobName);
                spool.Add(jobName, spooledJob);

                // Notifica a inserção de um novo job no spool
                if (listener != null)
                {
                    listener.NotifyObject(new JobNotification(JobNotificationTypeEnum.JobCreated, jobName));
                }
            }
        }
Example #2
0
        private void SpoolFileChanged(Object sender, FileSystemEventArgs e)
        {
            // todo: abrir thread (BackgroundWorker) para tratamento da ação

            if (fileMap.ContainsKey(e.FullPath))
            {
                String     jobName    = fileMap[e.FullPath];
                SpooledJob spooledJob = spool[jobName];
                // Reseta a instancia para obter dados atualizados
                spooledJob.ResetInstance();

                // Notifica a alteração de um job no spool
                if (listener != null)
                {
                    listener.NotifyObject(new JobNotification(JobNotificationTypeEnum.JobChanged, jobName));
                }
            }
        }