• 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:
parent
0641588ee8
commit
f1af6e9d6c
@ -15,6 +15,20 @@ namespace VEPROMS
|
|||||||
{
|
{
|
||||||
public partial class DlgPrintProcedure : DevComponents.DotNetBar.Office2007Form
|
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 DocVersionInfo _DocVersionInfo = null;
|
||||||
private bool _AllProcedures;
|
private bool _AllProcedures;
|
||||||
private DocVersionConfig _DocVersionConfig;
|
private DocVersionConfig _DocVersionConfig;
|
||||||
@ -47,8 +61,23 @@ namespace VEPROMS
|
|||||||
get { return txbPdfLocationS.Text; }
|
get { return txbPdfLocationS.Text; }
|
||||||
set { txbPdfLocationS.Text = value; }
|
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)
|
public DlgPrintProcedure(DocVersionInfo dvi)
|
||||||
{
|
{
|
||||||
|
_Automatic = false;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_AllProcedures = true;
|
_AllProcedures = true;
|
||||||
_DocVersionConfig = dvi.DocVersionConfig;
|
_DocVersionConfig = dvi.DocVersionConfig;
|
||||||
@ -98,11 +127,13 @@ namespace VEPROMS
|
|||||||
// If yes, the Change bar tab is the selected tab.
|
// If yes, the Change bar tab is the selected tab.
|
||||||
if (_DocVersionConfig.Print_ChangeBar == PrintChangeBar.SelectBeforePrinting)
|
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)
|
if (dr == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
btnChgBarOn.PerformClick();
|
btnChgBarOn.PerformClick();
|
||||||
tabControl1.SelectedTab = tbChangeBars;
|
if(!Automatic) tabControl1.SelectedTab = tbChangeBars;
|
||||||
rbFormatDefault.PerformClick();
|
rbFormatDefault.PerformClick();
|
||||||
rbFormatDefault.Checked = true; // default to 'Format Default'
|
rbFormatDefault.Checked = true; // default to 'Format Default'
|
||||||
}
|
}
|
||||||
@ -158,8 +189,18 @@ namespace VEPROMS
|
|||||||
private void DlgPrintProcedure_Load(object sender, EventArgs e)
|
private void DlgPrintProcedure_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SetupForProcedure();
|
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()
|
private void SetupForProcedure()
|
||||||
{
|
{
|
||||||
this.Text = "Create PDF for " + ProcNum;
|
this.Text = "Create PDF for " + ProcNum;
|
||||||
@ -343,13 +384,14 @@ namespace VEPROMS
|
|||||||
{
|
{
|
||||||
SetupForProcedure();
|
SetupForProcedure();
|
||||||
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);
|
||||||
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;
|
frmStatus.CloseWhenDone = true;
|
||||||
|
Application.DoEvents();
|
||||||
frmStatus.ShowDialog();
|
frmStatus.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.Close();
|
if(!Automatic)
|
||||||
ShowDebugFiles();
|
ShowDebugFiles();
|
||||||
}
|
}
|
||||||
private void CreateDebugFiles()
|
private void CreateDebugFiles()
|
||||||
{
|
{
|
||||||
@ -375,7 +417,7 @@ namespace VEPROMS
|
|||||||
// Determine change bar settings. First get from config & then see if override from dialog.
|
// Determine change bar settings. First get from config & then see if override from dialog.
|
||||||
// Also check that format allows override.
|
// Also check that format allows override.
|
||||||
ChangeBarDefinition cbd = DetermineChangeBarSettings();
|
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();
|
frmStatus.ShowDialog();
|
||||||
this.Close();
|
this.Close();
|
||||||
ShowDebugFiles();
|
ShowDebugFiles();
|
||||||
@ -442,6 +484,7 @@ namespace VEPROMS
|
|||||||
, TimeSpan.FromTicks(DateTime.Now.Ticks - dtStart.Ticks).TotalMinutes),
|
, TimeSpan.FromTicks(DateTime.Now.Ticks - dtStart.Ticks).TotalMinutes),
|
||||||
"Printing Duration", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
"Printing Duration", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
|
this.Close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CreatePDF();
|
CreatePDF();
|
||||||
|
@ -40,14 +40,15 @@ namespace VEPROMS
|
|||||||
get { return _OpenPDF; }
|
get { return _OpenPDF; }
|
||||||
set { _OpenPDF = value; }
|
set { _OpenPDF = value; }
|
||||||
}
|
}
|
||||||
public frmPDFStatusForm(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd,string pdfFile)
|
private Point _NewLocation;
|
||||||
|
public frmPDFStatusForm(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd,string pdfFile, Point newLocation)
|
||||||
{
|
{
|
||||||
OpenPDF = openPDF;
|
OpenPDF = openPDF;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
MyPromsPrinter = new PromsPrinter(myItem, rev, revDate, watermark, debugOutput, pdfPath + @"\\Compare", false, overWrite, cbd, pdfFile);//openPDF);
|
MyPromsPrinter = new PromsPrinter(myItem, rev, revDate, watermark, debugOutput, pdfPath + @"\\Compare", false, overWrite, cbd, pdfFile);//openPDF);
|
||||||
PDFPath = pdfPath;
|
PDFPath = pdfPath;
|
||||||
this.Text = "Creating PDF of " + myItem.DisplayNumber;
|
this.Text = "Creating PDF of " + myItem.DisplayNumber;
|
||||||
|
_NewLocation = newLocation;
|
||||||
}
|
}
|
||||||
void pp_StatusChanged(object sender, PromsPrintStatusArgs args)
|
void pp_StatusChanged(object sender, PromsPrintStatusArgs args)
|
||||||
{
|
{
|
||||||
@ -71,6 +72,7 @@ namespace VEPROMS
|
|||||||
|
|
||||||
private void frmPDFStatusForm_Load(object sender, EventArgs e)
|
private void frmPDFStatusForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Location = _NewLocation;
|
||||||
tmrRun.Enabled = true;
|
tmrRun.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +342,38 @@ namespace VEPROMS
|
|||||||
if (VlnSettings.DemoMode) StepRTB.MyFontFamily = GetFamily("Bookman Old Style");
|
if (VlnSettings.DemoMode) StepRTB.MyFontFamily = GetFamily("Bookman Old Style");
|
||||||
displaySearch1.Enter += new EventHandler(displaySearch1_Enter);
|
displaySearch1.Enter += new EventHandler(displaySearch1_Enter);
|
||||||
ctrlAnnotationDetails.Enter += new EventHandler(ctrlAnnotationDetails_Enter);
|
ctrlAnnotationDetails.Enter += new EventHandler(ctrlAnnotationDetails_Enter);
|
||||||
|
RunAutomatic();
|
||||||
}
|
}
|
||||||
|
private void RunAutomatic()
|
||||||
|
{
|
||||||
|
string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray());
|
||||||
|
bool ranAuto = false;
|
||||||
|
foreach (string parameter in parameters)
|
||||||
|
{
|
||||||
|
if(parameter.StartsWith("/P="))
|
||||||
|
{
|
||||||
|
string[] dvstrs = parameter.Substring(3).Split(",".ToCharArray());
|
||||||
|
foreach (string dvstr in dvstrs)
|
||||||
|
{
|
||||||
|
DocVersionInfo dvi = DocVersionInfo.Get(int.Parse(dvstr));
|
||||||
|
if (dvi != null)
|
||||||
|
{
|
||||||
|
DlgPrintProcedure prnDlg = new DlgPrintProcedure(dvi,true);
|
||||||
|
prnDlg.ShowDialog();
|
||||||
|
//prnDlg.FormClosed += new FormClosedEventHandler(prnDlg_FormClosed);
|
||||||
|
//while (!_RunNext) Application.DoEvents();
|
||||||
|
ranAuto = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ranAuto) this.Close();
|
||||||
|
}
|
||||||
|
private bool _RunNext = false;
|
||||||
|
//void prnDlg_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
|
//{
|
||||||
|
// _RunNext = true;
|
||||||
|
//}
|
||||||
private FontFamily GetFamily(string name)
|
private FontFamily GetFamily(string name)
|
||||||
{
|
{
|
||||||
foreach (FontFamily ff in FontFamily.Families)
|
foreach (FontFamily ff in FontFamily.Families)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user