/// <summary> /// Checks print job and printer status /// </summary> private void TimerCall() { timer.Enabled = false; bool jobfound = false; bool hasTrouble = false; try { string statusReport = ""; //_printerStatus |= PrintHelper.GetPrinterStatus(_printJob.ServerHost, _printJob.PrintJobTitle.PrinterName, out statusReport); _printerStatus |= PrintHelper.GetPrinterStatus(PrintJobTitle.Host, PrintJobTitle.PrinterName, out statusReport); if ((_printerStatus | PrinterTrouble.None) == PrinterTrouble.None) { hasTrouble = false; } else { hasTrouble = true; } // if issue found if (hasTrouble) { // send data to server //OnIssueFound(new PrinterIssueEventArgs(_printJob.PrintJobTitle.PrinterName, _printerStatus, statusReport)); OnIssueFound(new PrinterIssueEventArgs(PrintJobTitle.PrinterName, _printerStatus, statusReport)); OnCanBeDisposed(EventArgs.Empty); return; } // find the job //foreach (var printJob in PrintHelper.GetPrintJobs(_printJob.ServerHost, _printJob.PrintJobTitle.PrinterName)) foreach (var printJob in PrintHelper.GetPrintJobs(PrintJobTitle.Host, PrintJobTitle.PrinterName)) { //if (PrintHelper.ExtractDocumentName(printJob) == _printJob.PrintJobTitle.Document) if (PrintHelper.ExtractDocumentName(printJob) == PrintJobTitle.Document) { jobfound = true; break; } } } catch (Exception ex) { WPFNotifier.DebugError(ex); } // if job found if (jobfound) { // continue watching timer.Enabled = true; } else { // finish watching OnJobCompleted(new PrintJobDataEventArgs(null)); OnCanBeDisposed(EventArgs.Empty); } }