コード例 #1
0
ファイル: PrintingManager.cs プロジェクト: xoposhiy/KOIB
        public bool PrintReport(PrinterJob printerJob)
        {
            Logger.LogInfo(Message.PrintingPrintReport, printerJob.ReportType);
            var eventArgs = new PrintReportEventArgs(printerJob);

            try
            {
                PrintReportStarting.RaiseEvent(this, eventArgs);
                ExecutePrinterJob(printerJob);
                return(true);
            }
            catch (ThreadAbortException)
            {
                return(false);
            }
            catch (Exception ex)
            {
                if (ex is CupsFailureException)
                {
                    CancelJobs(_findPrinterName);
                    EnablePrinter(_findPrinterName);
                }
                Logger.LogError(Message.PrintingError, ex, printerJob.FilePath);
                return(false);
            }
            finally
            {
                PrintReportFinished.RaiseEvent(this, eventArgs);
            }
        }
コード例 #2
0
ファイル: PrintingManager.cs プロジェクト: nico-izo/KOIB
 public bool PrintReport(PrinterJob printerJob)
 {
     Logger.LogInfo(Message.PrintingPrintReport, printerJob.ReportType);
     var eventArgs = new PrintReportEventArgs(printerJob);
     try
     {
         PrintReportStarting.RaiseEvent(this, eventArgs);
         ExecutePrinterJob(printerJob);
         return true;
     }
     catch (ThreadAbortException)
     {
         return false;
     }
     catch (Exception ex)
     {
         if (ex is CupsFailureException)
         {
             CancelJobs(_findPrinterName);
             EnablePrinter(_findPrinterName);
         }
         Logger.LogError(Message.PrintingError, ex, printerJob.FilePath);
         return false;
     }
     finally
     {
         PrintReportFinished.RaiseEvent(this, eventArgs);
     }
 }