B2019-106 Added Error Handling to code that opens PDF file
This commit is contained in:
parent
2df227fdaa
commit
04d3770f40
@ -239,35 +239,43 @@ namespace VEPROMS
|
||||
// - requested by Calvert Cliffs
|
||||
private void OpenPDFandPlacekeeper(string pdffile)
|
||||
{
|
||||
if ((pdffile ?? "") != "" && !OnlyShowContinuousActionSummary)
|
||||
try // B2019-106 Error Handling for PDF Open
|
||||
{
|
||||
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile);
|
||||
sdp.WaitForInputIdle();
|
||||
if ((pdffile ?? "") != "" && !OnlyShowContinuousActionSummary)
|
||||
{
|
||||
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile);
|
||||
if (sdp != null)
|
||||
sdp.WaitForInputIdle();
|
||||
}
|
||||
if (OnlyShowContinuousActionSummary)
|
||||
System.IO.File.Delete(pdffile); // remove the temporary PDF file used to create the Continuous Action Summary
|
||||
if (MyPromsPrinter.MyPlacekeeper != null)
|
||||
{
|
||||
// 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);
|
||||
System.Threading.Thread.Sleep(mydelay);
|
||||
MyPromsPrinter.MyPlacekeeper.Visible();
|
||||
}
|
||||
// this will display the generated Continuous Action Summary in MS Word (starting a new instance of MS Word outside of PROMS)
|
||||
if (MyPromsPrinter.MyContActSummary != null)
|
||||
{
|
||||
string instructions = "The Continuous Action Summary will be opened in MS Word.\n\nYou can make modifications and copy it into a PROMS Word section.";
|
||||
MessageBox.Show(instructions, "Continuous Action Summary");
|
||||
// The ContActSummaryDelay is a switch that can be added to the PROMS.exe shortcut
|
||||
// ex: VEPROMS.EXE /ContActSummaryDelay=2.5 will delay it 2 1/2 seconds
|
||||
float delay = Volian.Base.Library.VlnSettings.GetCommandFloat("ContActSummaryDelay", 1.0f);
|
||||
int mydelay = (int)(1000 * delay);
|
||||
System.Threading.Thread.Sleep(mydelay);
|
||||
MyPromsPrinter.MyContActSummary.Visible();
|
||||
}
|
||||
}
|
||||
if (OnlyShowContinuousActionSummary)
|
||||
System.IO.File.Delete(pdffile); // remove the temporary PDF file used to create the Continuous Action Summary
|
||||
if (MyPromsPrinter.MyPlacekeeper != null)
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 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);
|
||||
System.Threading.Thread.Sleep(mydelay);
|
||||
MyPromsPrinter.MyPlacekeeper.Visible();
|
||||
string str = string.Format("{0} - {1} - {2}",pdffile,ex.GetType().Name,ex.Message);
|
||||
MessageBox.Show(str, "Error Opening PDFFile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
// this will display the generated Continuous Action Summary in MS Word (starting a new instance of MS Word outside of PROMS)
|
||||
if (MyPromsPrinter.MyContActSummary != null)
|
||||
{
|
||||
string instructions = "The Continuous Action Summary will be opened in MS Word.\n\nYou can make modifications and copy it into a PROMS Word section.";
|
||||
MessageBox.Show(instructions, "Continuous Action Summary");
|
||||
// The ContActSummaryDelay is a switch that can be added to the PROMS.exe shortcut
|
||||
// ex: VEPROMS.EXE /ContActSummaryDelay=2.5 will delay it 2 1/2 seconds
|
||||
float delay = Volian.Base.Library.VlnSettings.GetCommandFloat("ContActSummaryDelay", 1.0f);
|
||||
int mydelay = (int)(1000 * delay);
|
||||
System.Threading.Thread.Sleep(mydelay);
|
||||
MyPromsPrinter.MyContActSummary.Visible();
|
||||
}
|
||||
|
||||
}
|
||||
private void btnOpenFolder_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user