private void reportProgress(object sender, ProgressEventArgs e) { String task = e.task; int page = e.page; int currRecord = e.currRecord; int recordCount = e.recordCount; if (m_cancelPrinting) { if (cWindow.ask("Confirm you want to cancel the execution of this report?", MessageBoxDefaultButton.Button2)) { e.cancel = true; closeProgressDlg(); return; } else { m_cancelPrinting = false; } } if (m_fProgress == null) { return; } if (page > 0) { m_fProgress.lbCurrPage.Text = page.ToString(); } if (task != "") { m_fProgress.lbTask.Text = task; } if (currRecord > 0) { m_fProgress.lbCurrRecord.Text = currRecord.ToString(); } if (recordCount > 0 && cUtil.val(m_fProgress.lbRecordCount.Text) != recordCount) { m_fProgress.lbRecordCount.Text = recordCount.ToString(); } double percent = 0; if (recordCount > 0 && currRecord > 0) { percent = Convert.ToDouble(currRecord) / recordCount; var value = Convert.ToInt32(percent * 100); if (value > 100) value = 100; m_fProgress.prgBar.Value = value; } Application.DoEvents(); }
protected virtual bool OnProgress(String task, int page, int currRecord, int recordCount) { bool cancel = false; if (Progress != null) { ProgressEventArgs e = new ProgressEventArgs(task, page, currRecord, recordCount); Progress(this, e); cancel = e.cancel; } return !cancel; }