B2019-106 Added Error Handling to code that opens PDF file

This commit is contained in:
Rich 2019-08-06 19:36:47 +00:00
parent 2df227fdaa
commit 04d3770f40

View File

@ -238,10 +238,13 @@ namespace VEPROMS
// set a delay so that the word document containing the newly generated placekeeper will appear on top of everything else.
// - requested by Calvert Cliffs
private void OpenPDFandPlacekeeper(string pdffile)
{
try // B2019-106 Error Handling for PDF Open
{
if ((pdffile ?? "") != "" && !OnlyShowContinuousActionSummary)
{
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile);
if (sdp != null)
sdp.WaitForInputIdle();
}
if (OnlyShowContinuousActionSummary)
@ -251,7 +254,7 @@ namespace VEPROMS
// The PlacekeeperDelay is a switch that can be added to the PROMS.exe shortcut
// ex: VEPROMS.EXE /PlacekeeperDelay=2.5 will delay it 2 1/2 seconds
float delay = Volian.Base.Library.VlnSettings.GetCommandFloat("PlacekeeperDelay", 3.0f);
int mydelay =(int) (1000 * delay);
int mydelay = (int)(1000 * delay);
System.Threading.Thread.Sleep(mydelay);
MyPromsPrinter.MyPlacekeeper.Visible();
}
@ -267,7 +270,12 @@ namespace VEPROMS
System.Threading.Thread.Sleep(mydelay);
MyPromsPrinter.MyContActSummary.Visible();
}
}
catch (Exception ex)
{
string str = string.Format("{0} - {1} - {2}",pdffile,ex.GetType().Name,ex.Message);
MessageBox.Show(str, "Error Opening PDFFile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
private void btnOpenFolder_Click(object sender, EventArgs e)
{