From bf5337cf63fb19ad1c22bc1e51e3878f95c81f61 Mon Sep 17 00:00:00 2001 From: John Jenko Date: Tue, 20 Aug 2024 12:25:42 -0400 Subject: [PATCH] B2024-062 printing a procedure that is empty displays the Empty Procedure message. WhenOK button is clicked, PROMS will exit the Print function.. (#393) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit B2024-062 When you attempt to print a procedure that is empty (i.e. none of the sections are applicable to the selected Child to print), the Empty Procedure message appears. When you click the OK button PROMS will now simply exit the Print function instead of displaying the “Try Again” message box. Reviewed-on: https://git.volian.com/Volian/SourceCode/pulls/393 Reviewed-by: Paul Larsen Co-authored-by: John Jenko Co-committed-by: John Jenko --- PROMS/VEPROMS User Interface/frmPDFStatusForm.cs | 5 ++++- PROMS/Volian.Print.Library/PromsPrinter.cs | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs index 91c20e91..9ef8319b 100644 --- a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs +++ b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs @@ -295,7 +295,10 @@ namespace VEPROMS } } - while (!MyPromsPrinter.MergeNotIncluded && _PdfFile == null && MessageBox.Show("Try Again?", "PDF Creation Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes); + // B2024-062 Added check for EmptyProcedure. We don't need to show the Try Again message if the procedure + // is empty, as it would be just be a waste of time for the user. + while (!MyPromsPrinter.MergeNotIncluded && _PdfFile == null && !MyPromsPrinter.EmptyProcedure && + MessageBox.Show("Try Again?", "PDF Creation Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes); if (_PdfFile == null) diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index ee22b33e..bd55fe6f 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -138,6 +138,15 @@ namespace Volian.Print.Library get { return _Prefix; } set { _Prefix = value; } } + + // B2024-062 Set to true when the procedure being printed has no content. + // When set to true, will prevent the "Try Again" dialog from appearing + // and simply exit the print function + private bool _EmptyProcedure = false; + public bool EmptyProcedure + { + get { return _EmptyProcedure; } + } private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public event PromsPrinterStatusEvent StatusChanged; internal void OnStatusChanged(object sender, PromsPrintStatusArgs args) @@ -933,6 +942,9 @@ namespace Volian.Print.Library { MessageBox.Show("This procedure has no content and will not be printed.", "Empty Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information); ProfileTimer.Pop(profileDepth); + // B2024-062 Added check for EmptyProcedure. This is to prevent the Try Again message + // from appearing after the user clicks on the OK button from the Empty Procedure message + _EmptyProcedure = true; return null; } OnStatusChanged(myProcedure.DisplayNumber, PromsPrinterStatusType.ProgressSetup, myProcedure.Sections.Count);