Spotfire.Dxp.Framework.ApplicationModel Progress
Namespace: Spotfire.Dxp.Framework.ApplicationModel
Assembly: Spotfire.Dxp.Framework (in Spotfire.Dxp.Framework.dll) Version: 14.10.7525.5058 (14.10.7525.5058)
It is possible to access the currently ongoing progress object through a call to CurrentProgress. Using this object, new sub tasks can be created, progress can be reported, and one can check for cancellations of the progress. In cases where no progress has been created through a call to ExecuteWithProgress(String, String, ProgressOperation), a default progress object is returned using which operations can be executed. Note, however, that no progress dialog is associated with this default progress object.
It is important to note that all code executed with progress is executed within a worker thread. Unhandled exceptions that may occur in this thread, are re-thrown in the main application thread wrapped in a TargetInvocationException.
This class cannot be extended through inheritance.
ProgressService progressService = GetService<ProgressService>(); progressService.ExecuteWithProgress("Opening File", delegate { // Do some work // ... ProgressService.CurrentProgress.ExecuteSubtask( "Sub task", stepCount, "Step {0} of {1}", delegate { try { // Perform subtask for (int i = 0; i < stepCount; i++) { // Do something // ... ProgressService.CurrentProgress.TryReportProgress(); ProgressService.CurrentProgress.CheckCancel(); } } catch (ProgressOperationCanceledException) { // Handle exception } finally { // Perform Cleanup } }); // Do more work // ... }