diff --git a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs index 90d177f5..3fb92a57 100644 --- a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs +++ b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs @@ -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) diff --git a/PROMS/Volian.Print.Library/Placekeeper.cs b/PROMS/Volian.Print.Library/Placekeeper.cs index ed06f8ef..81212921 100644 --- a/PROMS/Volian.Print.Library/Placekeeper.cs +++ b/PROMS/Volian.Print.Library/Placekeeper.cs @@ -23,6 +23,11 @@ namespace Volian.Print.Library _WordSel = _WordApp.Selection; _pkFont = new VE_Font("Arial", 11, E_Style.None, 12); // Calvert uses Arial for their Placekeepers. } + public void Visible() + { + _WordApp.Visible = true; + _WordApp.Activate(); + } //public Placekeeper(pkParagraph myPlacekeeper) //{ // _WordApp = new LBApplicationClass(); @@ -53,7 +58,7 @@ namespace Volian.Print.Library _WordApp = new LBApplicationClass(); _WordDoc = _WordApp.Documents.Add(); _WordSel = _WordApp.Selection; - _WordApp.Visible = true; + //_WordApp.Visible = true; _pkFont = pkFont; AddTable(); AddHeader(); diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index cbd6b151..3d81564f 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -644,13 +644,19 @@ namespace Volian.Print.Library // pkFont = ds.Font; //} if (_MyHelper.MyPlacekeepers.Count > 0) - new Placekeeper(_MyHelper.MyPlacekeepers, pkFont); + MyPlacekeeper = new Placekeeper(_MyHelper.MyPlacekeepers, pkFont); } _MyHelper = null; ProfileTimer.Pop(profileDepth); return outputFileName; } + private Placekeeper _MyPlacekeeper = null; + public Placekeeper MyPlacekeeper + { + get { return _MyPlacekeeper; } + set { _MyPlacekeeper = value; } + } public void CreateWordDocPdf(PdfContentByte cb, SectionInfo mySection, ref PdfReader readerWord, ref string myPdfFile) { int profileDepth = ProfileTimer.Push(">>>> CreateWordDocPdf");