Show Progress bar when Printing all procedures
Added Cancel button for printing all procedures Added Timer for automatic processes
This commit is contained in:
@@ -13,12 +13,30 @@ namespace VEPROMS
|
||||
{
|
||||
public partial class frmPDFStatusForm : Form
|
||||
{
|
||||
private bool _CancelPrinting = false;
|
||||
public bool CancelPrinting
|
||||
{
|
||||
get { return _CancelPrinting; }
|
||||
set { _CancelPrinting = value; }
|
||||
}
|
||||
private bool _CloseWhenDone = false;
|
||||
public bool CloseWhenDone
|
||||
{
|
||||
get { return _CloseWhenDone; }
|
||||
set { _CloseWhenDone = value; }
|
||||
}
|
||||
private bool _CancelStop = false;
|
||||
public bool CancelStop
|
||||
{
|
||||
get { return _CancelStop; }
|
||||
set { _CancelStop = value; }
|
||||
}
|
||||
private bool _Stop = false;
|
||||
public bool Stop
|
||||
{
|
||||
get { return _Stop; }
|
||||
set { _Stop = value; }
|
||||
}
|
||||
private string _PDFPath;
|
||||
|
||||
public string PDFPath
|
||||
@@ -52,6 +70,7 @@ namespace VEPROMS
|
||||
PDFPath = pdfPath;
|
||||
this.Text = "Creating PDF of " + myItem.DisplayNumber;
|
||||
_NewLocation = newLocation;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
public bool AllowAllWatermarks
|
||||
{
|
||||
@@ -71,6 +90,7 @@ namespace VEPROMS
|
||||
pb.Text = string.Format("Processing {0} ({1} of {2})", args.MyStatus, args.Progress + 1, pb.Maximum);
|
||||
}
|
||||
MyStatus = args.MyStatus;
|
||||
Application.DoEvents();
|
||||
}
|
||||
public string MyStatus
|
||||
{
|
||||
@@ -89,6 +109,8 @@ namespace VEPROMS
|
||||
private void tmrRun_Tick(object sender, EventArgs e)
|
||||
{
|
||||
tmrRun.Enabled = false;
|
||||
if (CancelStop) btnCancel.Visible = true;
|
||||
Application.DoEvents();
|
||||
MyPromsPrinter.StatusChanged += new PromsPrinterStatusEvent(pp_StatusChanged);
|
||||
DateTime tStart = DateTime.Now;
|
||||
_PdfFile = MyPromsPrinter.Print(PDFPath);
|
||||
@@ -113,18 +135,21 @@ namespace VEPROMS
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOpenPDF_Click(object sender, EventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start(_PdfFile);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnOpenFolder_Click(object sender, EventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start("Explorer", "/select," + _PdfFile);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
CancelPrinting = true;
|
||||
btnCancel.Text = "Cancelled";
|
||||
btnCancel.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user