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.
Namespace: Spotfire.Dxp.Framework.ApplicationModel
Assembly: Spotfire.Dxp.Framework (in Spotfire.Dxp.Framework.dll) Version: 25.11.10401.3615 (25.11.10401.3615)
Syntax
C#
public void ExecuteSubtask( string title, long totalSteps, string progressDescription, ProgressOperation operation )
Parameters
- title
- Type: SystemString
A user-friendly representation of what the sub task performs. May not be null. - totalSteps
- Type: SystemInt64
The number of steps in this operation. - progressDescription
- Type: SystemString
A description of the progress of the operation. This parameters allows for two placeholders to be included. The first placeholder, if included, will be replaced with a number representing the amount of progress reported to the subtask through calls to the TryReportProgress method. The placeholders are passed in as {0} and {1}, for example "Performed {0} read operation {1}". Note that passing more than two placeholder causes an exception of type FormatException to be thrown.This parameter may not be null.
- operation
- Type: Spotfire.Dxp.Framework.ApplicationModelProgressOperation
The operation to execute. The operation may either be defined as an anonymous delegate or a local method wrapped in a ProgressOperation. This parameter may not be null.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | If either title, progressDescription, or operation is null. |
ArgumentOutOfRangeException | If totalSteps is negative. |
FormatException | If progressDescription contains more than two placeholders. |
Remarks
Examples
C#
ProgressService progressService = GetService<ProgressService>(); progressService.ExecuteWithProgress("Opening File", delegate { // Do some work // ... ProgressService.CurrentProgress.ExecuteSubtask( "Sub task", stepCount, "Step {0} of {1}", delegate { // Perform subtask for (int i = 0; i < stepCount; i++) { // Do something // ... ProgressService.CurrentProgress.TryReportProgress(); ProgressService.CurrentProgress.CheckCancel(); } }); // Do more work // ... }
Version Information
See Also