Spotfire.Dxp.Framework.ApplicationModelProgress
Namespace: Spotfire.Dxp.Framework.ApplicationModel
Assembly: Spotfire.Dxp.Framework (in Spotfire.Dxp.Framework.dll) Version: 65.0.19510.3242 (65.0.19510.3242)
public abstract class Progress
The Progress type exposes the following members.
Name | Description | |
---|---|---|
BeginSubtask |
Starts a new determinate subtask, that is, a subtask in which the
extent of the operation is known, for example that it requires x
steps to be performed.
| |
CheckCancel |
Checks if the current progress operation has been canceled by the user
and if so, throws a ProgressCanceledException.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
ExecuteSubtask(String) |
Marks the start of a new subtask.
| |
ExecuteSubtask(String, ProgressOperation) |
Starts a new continuous subtask, that is, a subtask in
which the extent of the operation is either not known or not of
interest.
| |
ExecuteSubtask(String, Int64, String, ProgressOperation) |
Starts a new determinate subtask, that is, a subtask in which the
extent of the operation is known, for example that it requires x
steps to be performed.
| |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
TryReportProgress | Reports one unit of progress to the currently executing subtask.
| |
TryReportProgress(Int64) | Report one or more steps of progress to the currently
executing subtask.
|
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 // ... }