Progress Class TIBCO Spotfire 6.5 API Reference
Represents progress of an operation that has been started through a call to the ExecuteWithProgress(String, String, ProgressOperation).
Inheritance Hierarchy

System Object
  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)
Syntax

public abstract class Progress
Remarks

Within the extent of a progress, sub tasks (that is, sub operations) may be executed. Sub tasks can be nested in a way that forms a tree where the progress object is the root node. When executed, each node in this tree is visited depth first, and the operation associated with each node is executed. Sub tasks are executed with one of the ExecuteSubtask method in this class.

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.

Examples

The following example shows an operation containing a subtask being executed with progress.
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 
        // ...
    }
Version Information

Supported in: 6.5, 6.0, 5.5, 5.0, 4.5
See Also