• Add ability to print all procedures from the command-line.
• Position frmPDFStatusForm below this form. • Close the dialog when all procedures are printed. Position this form at a specific location. Command-Line Print all procedures for a specified DocVersionID
This commit is contained in:
@@ -15,6 +15,20 @@ namespace VEPROMS
|
||||
{
|
||||
public partial class DlgPrintProcedure : DevComponents.DotNetBar.Office2007Form
|
||||
{
|
||||
private bool _Automatic;
|
||||
public bool Automatic
|
||||
{
|
||||
get { return _Automatic; }
|
||||
set { _Automatic = value; }
|
||||
}
|
||||
private void RunAutomatic()
|
||||
{
|
||||
cbxDebugPagination.Checked = true;
|
||||
cbxDebugText.Checked = true;
|
||||
Application.DoEvents();
|
||||
CreatePDFs();
|
||||
this.Close();
|
||||
}
|
||||
private DocVersionInfo _DocVersionInfo = null;
|
||||
private bool _AllProcedures;
|
||||
private DocVersionConfig _DocVersionConfig;
|
||||
@@ -47,8 +61,23 @@ namespace VEPROMS
|
||||
get { return txbPdfLocationS.Text; }
|
||||
set { txbPdfLocationS.Text = value; }
|
||||
}
|
||||
public DlgPrintProcedure(DocVersionInfo dvi, bool automatic)
|
||||
{
|
||||
_Automatic = automatic;
|
||||
InitializeComponent();
|
||||
_AllProcedures = true;
|
||||
_DocVersionConfig = dvi.DocVersionConfig;
|
||||
_DocVersionInfo = dvi;
|
||||
_MyProcedure = dvi.Procedures[0].MyProcedure;
|
||||
btnCreatePDF.Text = "Create PDFs";
|
||||
HandleDocVersionSettings();
|
||||
PrepForAllOrOne(false);
|
||||
// don't open all PDFs if doing All Procedures
|
||||
//cbxOpenAfterCreate2.Checked = dvi.DocVersionConfig.Print_AlwaysViewPDFAfterCreate;
|
||||
}
|
||||
public DlgPrintProcedure(DocVersionInfo dvi)
|
||||
{
|
||||
_Automatic = false;
|
||||
InitializeComponent();
|
||||
_AllProcedures = true;
|
||||
_DocVersionConfig = dvi.DocVersionConfig;
|
||||
@@ -98,11 +127,13 @@ namespace VEPROMS
|
||||
// If yes, the Change bar tab is the selected tab.
|
||||
if (_DocVersionConfig.Print_ChangeBar == PrintChangeBar.SelectBeforePrinting)
|
||||
{
|
||||
DialogResult dr = MessageBox.Show("Do you want change bars?", "Change Bars", MessageBoxButtons.YesNo);
|
||||
DialogResult dr = DialogResult.Yes;
|
||||
if(!Automatic)
|
||||
dr = MessageBox.Show("Do you want change bars?", "Change Bars", MessageBoxButtons.YesNo);
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
btnChgBarOn.PerformClick();
|
||||
tabControl1.SelectedTab = tbChangeBars;
|
||||
if(!Automatic) tabControl1.SelectedTab = tbChangeBars;
|
||||
rbFormatDefault.PerformClick();
|
||||
rbFormatDefault.Checked = true; // default to 'Format Default'
|
||||
}
|
||||
@@ -158,8 +189,18 @@ namespace VEPROMS
|
||||
private void DlgPrintProcedure_Load(object sender, EventArgs e)
|
||||
{
|
||||
SetupForProcedure();
|
||||
_MyTimer = new Timer();
|
||||
_MyTimer.Tick += new EventHandler(_MyTimer_Tick);
|
||||
_MyTimer.Interval = 100;
|
||||
_MyTimer.Enabled = true;
|
||||
}
|
||||
|
||||
void _MyTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
_MyTimer.Enabled = false;
|
||||
BringToFront();
|
||||
if (Automatic) RunAutomatic();
|
||||
}
|
||||
private Timer _MyTimer;
|
||||
private void SetupForProcedure()
|
||||
{
|
||||
this.Text = "Create PDF for " + ProcNum;
|
||||
@@ -343,13 +384,14 @@ namespace VEPROMS
|
||||
{
|
||||
SetupForProcedure();
|
||||
this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left,Bottom));
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
frmStatus.ShowDialog();
|
||||
}
|
||||
}
|
||||
this.Close();
|
||||
ShowDebugFiles();
|
||||
if(!Automatic)
|
||||
ShowDebugFiles();
|
||||
}
|
||||
private void CreateDebugFiles()
|
||||
{
|
||||
@@ -375,7 +417,7 @@ namespace VEPROMS
|
||||
// Determine change bar settings. First get from config & then see if override from dialog.
|
||||
// Also check that format allows override.
|
||||
ChangeBarDefinition cbd = DetermineChangeBarSettings();
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked,PDFPath, cbd, txbPDFName.Text);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked,PDFPath, cbd, txbPDFName.Text,new Point(Left,Bottom));
|
||||
frmStatus.ShowDialog();
|
||||
this.Close();
|
||||
ShowDebugFiles();
|
||||
@@ -442,6 +484,7 @@ namespace VEPROMS
|
||||
, TimeSpan.FromTicks(DateTime.Now.Ticks - dtStart.Ticks).TotalMinutes),
|
||||
"Printing Duration", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
CreatePDF();
|
||||
|
Reference in New Issue
Block a user