/// <summary> /// Proceso de Impresion de documentos /// </summary> private static async void PrintingProcess() { while (IsRunning) { var document = DocumentPrintStack.FirstOrDefault(); if (document.Value != null) { var service = new PrintManagerService(); if (service.SendToPrint(document.Value, "Enviar a OneNote 2013")) { // Eliminar y cambiar estado en la web api await PrintFormManager.DeleteForm(document.Key); // Eliminar en cola local PrintForm form; DocumentPrintStack.TryRemove(document.Key, out form); } } else Thread.Sleep(TimeSpan.FromSeconds(SleepingTime)); } }
/// <summary> /// Proceso de Creacion de Documentos /// </summary> private static void DocumentBuildProcess() { SetDefaultCulture(); while (IsRunning) { var document = DocumentBuildStack.FirstOrDefault(); if (document.Value != null) { var service = new PrintManagerService(); if (service.GenerateDocument(document.Value)) { // Si genera El documento en la carpeta temporal local PrintForm form; DocumentBuildStack.TryRemove(document.Key, out form); DocumentPrintStack.TryAdd(document.Key, document.Value); } } else Thread.Sleep(TimeSpan.FromSeconds(SleepingTime)); } }