ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Framework.Threading.Tasks Namespace / QueuedTask Class / Run Method / Run(Action,Progressor,TaskCreationOptions) Method
Example

In This Topic
    Run(Action,Progressor,TaskCreationOptions) Method
    In This Topic
    Queue a new task to the framework dispatcher thread using the specified progressor.
    Syntax
    Public Overloads Shared Function Run( _
       ByVal action As Action, _
       ByVal progressor As Progressor, _
       Optional ByVal creationOptions As TaskCreationOptions _
    ) As Task

    Parameters

    action
    progressor
    creationOptions
    Example
    Progressor - Simple and non-cancelable
    public async Task Progressor_NonCancelable()
    {
      ArcGIS.Desktop.Framework.Threading.Tasks.ProgressorSource ps = new ArcGIS.Desktop.Framework.Threading.Tasks.ProgressorSource("Doing my thing...", false);
    
      int numSecondsDelay = 5;
      //If you run this in the DEBUGGER you will NOT see the dialog
      await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => Task.Delay(numSecondsDelay * 1000).Wait(), ps.Progressor);
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also