logic to support exe switch that will delay when Word will display the newly generated Placekeeper

This commit is contained in:
2015-02-19 03:53:45 +00:00
parent a6ed94d8c6
commit cbc3df3023
3 changed files with 37 additions and 4 deletions

View File

@@ -145,25 +145,47 @@ namespace VEPROMS
MyStatus = string.Format("{0} created in {1:0.} milliseconds", _PdfFile, (TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds));
if (OpenPDF)
{
System.Diagnostics.Process.Start(_PdfFile);
OpenPDFandPlacekeeper(_PdfFile);
this.Close();
return;
}
btnOpenFolder.Visible = btnOpenPDF.Visible = true;
if (CloseWhenDone)
{
OpenPDFandPlacekeeper(null);
this.Close();
return;
}
}
private void btnOpenPDF_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(_PdfFile);
OpenPDFandPlacekeeper(_PdfFile);
this.Close();
}
// 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)
{
if ((pdffile ?? "") != "")
{
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile);
sdp.WaitForInputIdle();
}
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();
}
}
private void btnOpenFolder_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("Explorer", "/select," + _PdfFile);
OpenPDFandPlacekeeper(null);
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)