B2017-221 Allow the batch dialog to close when waiting to process

This commit is contained in:
Rich 2017-09-26 17:56:29 +00:00
parent 06a29d83a0
commit 6d350ed94f
2 changed files with 17 additions and 6 deletions

View File

@ -1168,6 +1168,7 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Administrative Tools"; this.Text = "Administrative Tools";
this.Load += new System.EventHandler(this.frmBatchRefresh_Load); this.Load += new System.EventHandler(this.frmBatchRefresh_Load);
this.FormClosing +=frmBatchRefresh_FormClosing;// B2017-221 Allow the batch dialog to close when waiting to process.
this.splitContainer3.Panel1.ResumeLayout(false); this.splitContainer3.Panel1.ResumeLayout(false);
this.splitContainer3.Panel2.ResumeLayout(false); this.splitContainer3.Panel2.ResumeLayout(false);
this.splitContainer3.ResumeLayout(false); this.splitContainer3.ResumeLayout(false);

View File

@ -63,6 +63,12 @@ namespace VEPROMS
private Dictionary<TreeNode, DocVersionInfo> myDocVersions = new Dictionary<TreeNode, DocVersionInfo>(); private Dictionary<TreeNode, DocVersionInfo> myDocVersions = new Dictionary<TreeNode, DocVersionInfo>();
private void frmBatchRefresh_Load(object sender, EventArgs e) private void frmBatchRefresh_Load(object sender, EventArgs e)
{ {
IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
}
private bool IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
private void frmBatchRefresh_FormClosing(object sender, EventArgs e)
{
IsClosing = true;//B2017-221 Allow the batch dialog to close when waiting to process.
} }
// C2017-030 - new Admin Tools user interface // C2017-030 - new Admin Tools user interface
// check to see if at least one tree node is checked. // check to see if at least one tree node is checked.
@ -1058,7 +1064,8 @@ namespace VEPROMS
// C2017-030 New Admin Tools user interface // C2017-030 New Admin Tools user interface
// button clicks for processing selected tools // button clicks for processing selected tools
private void CheckProcessLater() // see if we should delay processing until later //B2017-221 Allow the batch dialog to close when waiting to process.
private bool CheckProcessLater() // see if we should delay processing until later
{ {
if (chkLater.Checked) if (chkLater.Checked)
{ {
@ -1068,16 +1075,19 @@ namespace VEPROMS
{ {
txtProcess.Clear(); txtProcess.Clear();
txtProcess.AppendText("Waiting..."); txtProcess.AppendText("Waiting...");
System.Threading.Thread.Sleep(60000); System.Threading.Thread.Sleep(1000);//Check each second
if (IsClosing) return false;//B2017-221 Allow the batch dialog to close when waiting to process.
Application.DoEvents();// Allow user interface to react
now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm")); now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
} }
} }
return true;// Close after complete
} }
// C2017-030 new Admin Tools user interface // C2017-030 new Admin Tools user interface
private void btn_ShowUsers_Click(object sender, EventArgs e) private void btn_ShowUsers_Click(object sender, EventArgs e)
{ {
CheckProcessLater(); // delay processing if set if (!CheckProcessLater()) return; // delay processing if set//B2017-221 Allow the batch dialog to close when waiting to process.
txtProcess.Clear(); txtProcess.Clear();
txtResults.Clear(); txtResults.Clear();
GetDatabaseSessions(); GetDatabaseSessions();
@ -1085,7 +1095,7 @@ namespace VEPROMS
private void btnFixLinks_Click(object sender, EventArgs e) private void btnFixLinks_Click(object sender, EventArgs e)
{ {
CheckProcessLater(); // delay processing if set if (!CheckProcessLater()) return; // delay processing if set//B2017-221 Allow the batch dialog to close when waiting to process.
txtProcess.Clear(); txtProcess.Clear();
txtResults.Clear(); txtResults.Clear();
if (swRefreshTrans.Value) if (swRefreshTrans.Value)
@ -1096,7 +1106,7 @@ namespace VEPROMS
private void btnRunCheck_Click(object sender, EventArgs e) private void btnRunCheck_Click(object sender, EventArgs e)
{ {
CheckProcessLater(); // delay processing if set if (!CheckProcessLater()) return; // delay processing if set//B2017-221 Allow the batch dialog to close when waiting to process.
int prgStpIdx = -1; int prgStpIdx = -1;
txtResults.Clear(); txtResults.Clear();
txtProcess.Clear(); txtProcess.Clear();
@ -1126,7 +1136,7 @@ namespace VEPROMS
private void btnRunRepair_Click(object sender, EventArgs e) private void btnRunRepair_Click(object sender, EventArgs e)
{ {
CheckProcessLater(); // delay processing if set if (!CheckProcessLater()) return; // delay processing if set//B2017-221 Allow the batch dialog to close when waiting to process.
int prgStpIdx = -1; int prgStpIdx = -1;
txtResults.Clear(); txtResults.Clear();
txtProcess.Clear(); txtProcess.Clear();