logic to support exe switch that will delay when Word will display the newly generated Placekeeper
This commit is contained in:
parent
a6ed94d8c6
commit
cbc3df3023
@ -145,25 +145,47 @@ namespace VEPROMS
|
|||||||
MyStatus = string.Format("{0} created in {1:0.} milliseconds", _PdfFile, (TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds));
|
MyStatus = string.Format("{0} created in {1:0.} milliseconds", _PdfFile, (TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds));
|
||||||
if (OpenPDF)
|
if (OpenPDF)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Process.Start(_PdfFile);
|
OpenPDFandPlacekeeper(_PdfFile);
|
||||||
this.Close();
|
this.Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
btnOpenFolder.Visible = btnOpenPDF.Visible = true;
|
btnOpenFolder.Visible = btnOpenPDF.Visible = true;
|
||||||
|
|
||||||
if (CloseWhenDone)
|
if (CloseWhenDone)
|
||||||
{
|
{
|
||||||
|
OpenPDFandPlacekeeper(null);
|
||||||
this.Close();
|
this.Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void btnOpenPDF_Click(object sender, EventArgs e)
|
private void btnOpenPDF_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Process.Start(_PdfFile);
|
OpenPDFandPlacekeeper(_PdfFile);
|
||||||
this.Close();
|
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)
|
private void btnOpenFolder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Process.Start("Explorer", "/select," + _PdfFile);
|
System.Diagnostics.Process.Start("Explorer", "/select," + _PdfFile);
|
||||||
|
OpenPDFandPlacekeeper(null);
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
private void btnCancel_Click(object sender, EventArgs e)
|
private void btnCancel_Click(object sender, EventArgs e)
|
||||||
|
@ -23,6 +23,11 @@ namespace Volian.Print.Library
|
|||||||
_WordSel = _WordApp.Selection;
|
_WordSel = _WordApp.Selection;
|
||||||
_pkFont = new VE_Font("Arial", 11, E_Style.None, 12); // Calvert uses Arial for their Placekeepers.
|
_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)
|
//public Placekeeper(pkParagraph myPlacekeeper)
|
||||||
//{
|
//{
|
||||||
// _WordApp = new LBApplicationClass();
|
// _WordApp = new LBApplicationClass();
|
||||||
@ -53,7 +58,7 @@ namespace Volian.Print.Library
|
|||||||
_WordApp = new LBApplicationClass();
|
_WordApp = new LBApplicationClass();
|
||||||
_WordDoc = _WordApp.Documents.Add();
|
_WordDoc = _WordApp.Documents.Add();
|
||||||
_WordSel = _WordApp.Selection;
|
_WordSel = _WordApp.Selection;
|
||||||
_WordApp.Visible = true;
|
//_WordApp.Visible = true;
|
||||||
_pkFont = pkFont;
|
_pkFont = pkFont;
|
||||||
AddTable();
|
AddTable();
|
||||||
AddHeader();
|
AddHeader();
|
||||||
|
@ -644,13 +644,19 @@ namespace Volian.Print.Library
|
|||||||
// pkFont = ds.Font;
|
// pkFont = ds.Font;
|
||||||
//}
|
//}
|
||||||
if (_MyHelper.MyPlacekeepers.Count > 0)
|
if (_MyHelper.MyPlacekeepers.Count > 0)
|
||||||
new Placekeeper(_MyHelper.MyPlacekeepers, pkFont);
|
MyPlacekeeper = new Placekeeper(_MyHelper.MyPlacekeepers, pkFont);
|
||||||
}
|
}
|
||||||
_MyHelper = null;
|
_MyHelper = null;
|
||||||
ProfileTimer.Pop(profileDepth);
|
ProfileTimer.Pop(profileDepth);
|
||||||
return outputFileName;
|
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)
|
public void CreateWordDocPdf(PdfContentByte cb, SectionInfo mySection, ref PdfReader readerWord, ref string myPdfFile)
|
||||||
{
|
{
|
||||||
int profileDepth = ProfileTimer.Push(">>>> CreateWordDocPdf");
|
int profileDepth = ProfileTimer.Push(">>>> CreateWordDocPdf");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user