Skip to main content
RSS feed Subscribe to feed

 

Export Tool Feature: Progress Display

The export may take some time. Adding progress makes for a better end user experience when running the tool.

Since the number of pages in the analysis can be determined, the progress handling is straightforward:

using (IDisposable disposable = ProgressService.CurrentProgress.BeginSubtask(
    "Export to HTML", pagesToPrint.Count,
    "Preparing page {0} out of {1}."))
{
    foreach (Page page in pagesToPrint)
    {
        ProgressService.CurrentProgress.TryReportProgress();
        ProgressService.CurrentProgress.CheckCancel();
        ...
    }
    ...
}