Added ability to perform a profile (Determine which sections of code are using the majority of the CPU time.)
Fixed logic that determines if the debug output should be created in the PDF. Added ability to track DB actions. Change cursor to a wait curcor when the print button is pressed. Added Profile debug Added a time-out for determining if a RO.FST file is newer. Added a property (PrintAllAtOnce) to the ItemInfo object so that the code can differentiate between objects that are being used for edit or print. Added logic to improve print performance. Specifically initialize a number of item properties when the procedure is loaded for printing, rather than waiting for the properties to be lazy-loaded. Added Profile debug Changed NextItem property to use GetNextItem method when printing.
This commit is contained in:
@@ -506,6 +506,10 @@ namespace VEPROMS
|
||||
private string _MultiunitPdfLocation = string.Empty;
|
||||
private void CreatePDFs()
|
||||
{
|
||||
if (VlnSettings.GetCommandFlag("PROFILE")) ProfileTimer.TurnOnTracking("Profile.txt");
|
||||
VEPROMS.CSLA.Library.Database.TrackDBUsage = VlnSettings.GetCommandFlag("DBTrack");
|
||||
ProfileTimer.Reset();
|
||||
int profileDepth = ProfileTimer.Push(">>>> CreatePdf");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (MySessionInfo != null)
|
||||
{
|
||||
@@ -525,8 +529,7 @@ namespace VEPROMS
|
||||
}
|
||||
CreateDebugFiles();
|
||||
// If file exists, determine if overwrite checkbox allows overwrite, if not prompt.
|
||||
|
||||
Volian.Print.Library.Rtf2Pdf.PdfDebug = true;
|
||||
Volian.Print.Library.Rtf2Pdf.PdfDebug = cbxDebug.Checked;
|
||||
PrintWatermark pw = (btnWaterMarkOn.Checked) ? (PrintWatermark)cbxWaterMark.SelectedValue : PrintWatermark.None;
|
||||
// Determine change bar settings. First get from config & then see if override from dialog.
|
||||
// Also check that format allows override.
|
||||
@@ -549,7 +552,7 @@ namespace VEPROMS
|
||||
pbPDFsStatus.TextVisible = true;
|
||||
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
pbPDFsStatus.Value = i;
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
string myPDFPath = GetMultiunitPDFPath();
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
@@ -570,10 +573,10 @@ namespace VEPROMS
|
||||
pbPDFsStatus.TextVisible = true;
|
||||
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
pbPDFsStatus.Value = i;
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
frmStatus.CancelStop = true;
|
||||
@@ -588,13 +591,15 @@ namespace VEPROMS
|
||||
pbPDFsStatus.TextVisible = true;
|
||||
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
pbPDFsStatus.Value = i;
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
int profileDepth1 = ProfileTimer.Push(">>>> GetItemAndChildren");
|
||||
if (MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
else
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
|
||||
ProfileTimer.Pop(profileDepth1);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
frmStatus.CancelStop = true;
|
||||
@@ -606,6 +611,13 @@ namespace VEPROMS
|
||||
pbPDFsStatus.Visible = false;
|
||||
if(!Automatic)
|
||||
ShowDebugFiles();
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
ProfileTimer.ShowTimerTable();
|
||||
if (VlnSettings.GetCommandFlag("DBTrack"))
|
||||
{
|
||||
VEPROMS.CSLA.Library.Database.TrackDBUsage = false;
|
||||
VEPROMS.CSLA.Library.Database.ShowDBTracking("DBTracking.txt");
|
||||
}
|
||||
}
|
||||
|
||||
private string GetMultiunitPDFPath()
|
||||
@@ -642,6 +654,10 @@ namespace VEPROMS
|
||||
}
|
||||
private void CreatePDF()
|
||||
{
|
||||
if (VlnSettings.GetCommandFlag("PROFILE")) ProfileTimer.TurnOnTracking("Profile.txt");
|
||||
VEPROMS.CSLA.Library.Database.TrackDBUsage = VlnSettings.GetCommandFlag("DBTrack");
|
||||
ProfileTimer.Reset();
|
||||
int profileDepth = ProfileTimer.Push(">>>> CreatePdf");
|
||||
string message = string.Empty;
|
||||
if (!MySessionInfo.CanCheckOutItem(MyProcedure.ItemID, CheckOutType.Procedure, ref message))
|
||||
{
|
||||
@@ -650,23 +666,34 @@ namespace VEPROMS
|
||||
}
|
||||
CreateDebugFiles();
|
||||
// If file exists, determine if overwrite checkbox allows overwrite, if not prompt.
|
||||
|
||||
Volian.Print.Library.Rtf2Pdf.PdfDebug = true;
|
||||
|
||||
Volian.Print.Library.Rtf2Pdf.PdfDebug = cbxDebug.Checked;
|
||||
PrintWatermark pw = (btnWaterMarkOn.Checked) ? (PrintWatermark)cbxWaterMark.SelectedValue : PrintWatermark.None;
|
||||
// Determine change bar settings. First get from config & then see if override from dialog.
|
||||
// Also check that format allows override.
|
||||
ChangeBarDefinition cbd = DetermineChangeBarSettings();
|
||||
int profileDepth2 = ProfileTimer.Push(">>>> CreatePdf.GetItemAndChildren");
|
||||
if (MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave > 0 || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
else
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
ProfileTimer.Pop(profileDepth2);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
|
||||
frmStatus.MakePlaceKeeper = cbxGeneratePlacekeeper.Checked;
|
||||
int profileDepth3 = ProfileTimer.Push(">>>> frmStatus");
|
||||
frmStatus.ShowDialog();
|
||||
ProfileTimer.Pop(profileDepth3);
|
||||
MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
|
||||
this.Close();
|
||||
ShowDebugFiles();
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
ProfileTimer.ShowTimerTable();
|
||||
if (VlnSettings.GetCommandFlag("DBTrack"))
|
||||
{
|
||||
VEPROMS.CSLA.Library.Database.TrackDBUsage = false;
|
||||
VEPROMS.CSLA.Library.Database.ShowDBTracking("DBTracking.txt");
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if any dialog selections for change bars have overridden the data
|
||||
@@ -723,11 +750,13 @@ namespace VEPROMS
|
||||
Rtf2iTextSharp.DoingComparison = cbxDebug.Checked;
|
||||
if (_AllProcedures)
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
DateTime dtStart = DateTime.Now;
|
||||
_MultiunitPdfLocation = cbxMultiunitPdfLocation.SelectedItem.ToString();
|
||||
PromsPrinter.ClearTransPageNumProblems();
|
||||
CreatePDFs();
|
||||
PromsPrinter.ReportTransPageNumProblems();
|
||||
this.Cursor = Cursors.Default;
|
||||
if (VlnSettings.DebugMode)
|
||||
{
|
||||
MessageBox.Show(string.Format("{0} Minutes to Print All Procedures"
|
||||
@@ -741,7 +770,11 @@ namespace VEPROMS
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
CreatePDF();
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
}
|
||||
private bool _Initializing = false;
|
||||
private void tbSettings_Click(object sender, EventArgs e)
|
||||
|
@@ -123,7 +123,9 @@ namespace VEPROMS
|
||||
if (!CancelStop) PromsPrinter.ClearTransPageNumProblems();
|
||||
do
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> MyPromsPrinter.Print");
|
||||
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
while (_PdfFile == null && MessageBox.Show("Try Again?", "PDF Creation Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
|
||||
if (_PdfFile == null)
|
||||
|
Reference in New Issue
Block a user