Gets a value indicating if the Cancel button has been pressed on the ProgressHelper dialog.

Namespace:  ESRI.ArcGISExplorer.Application

Assembly:  ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public bool IsCancelled { get; }
Visual Basic (Declaration)
Public ReadOnly Property IsCancelled As Boolean

Remarks

This property can be used to check for user cancellation of a ProgressHelper dialog, if the Cancel button is displayed. Set the CanCancel property to trueTruetruetrue (True in Visual Basic) before calling Show()()() in order to display a Cancel button at bottom of the dialog. This property should then be checked perodically while the dialog is displayed, and if trueTruetruetrue (True in Visual Basic) then the work performed by the dialog should be cancelled and the dialog closed, as shown in the example below.

Note:

Do not show the Cancel button unless there is a genuine opportunity to check for user cancellation and cancel the work.

Version Information: This property is supported from version 2.0.0.1500.

Examples

The code below demonstrates how to use the ProgressHelper class to display an information dialog to users while a lengthy operation is being undertaken, with an option to cancel the operation. The code sets the CanCancel property before showing the dialog, and then checks the IsCancelled property before each step, and if this is true (True in Visual Basic) then the remainder of the steps are avoided.
CopyC#
//Get the tree Stands FeatureLayer
FeatureLayer standsLayer = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.FindByName("Stands") as FeatureLayer;
//Get the tree Stands Table
Table standsTable = standsLayer.Table;

//Create a new ProgressHelper
using (ProgressHelper progDialog = new ProgressHelper("Insect impact analysis", "Finding affected trees", "Results"))
{
  //Show the ProgressHelper dialog
  progDialog.Show();

  //Assume all Point Notes relate to insect infestation sites
  foreach (Note insectSite in Application.ActiveMapDisplay.Map.GetMapItems<Note>())
  {
    if (insectSite.Graphic.Geometry is ESRI.ArcGISExplorer.Geometry.Point)
    {
      //update the main progress dialog message
      progDialog.UpdateInstruction(string.Format("Processing {0} site", insectSite));

      ESRI.ArcGISExplorer.Geometry.Point insectPnt = insectSite.Graphic.Geometry as ESRI.ArcGISExplorer.Geometry.Point;

      //Perform a search to find all affected tree stands within 1 mile of each location
      RowCollection affectedTreeStands = standsTable.SearchByDistance(insectPnt, 1, Unit.Miles);

      //Process each affected tree stand
      foreach (Row treeStand in affectedTreeStands)
      {
        //update the secondary progress dialog message
        progDialog.UpdateMessage(string.Format("Analyzing {0} stand", treeStand.Values["SCPTDATA_ID"].ToString()));
        //Do some analysis or output results...
      }
    }
  }
}
CopyVB.NET
'Get the tree Stands FeatureLayer
Dim standsLayer As FeatureLayer = DirectCast(ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.FindByName("Stands"), FeatureLayer)
'Get the tree Stands Table
Dim standsTable As Table = standsLayer.Table

'Create a new ProgressHelper
Using progDialog As New ProgressHelper("Insect impact analysis", "Finding affected trees", "Results")

  'Show the ProgressHelper dialog
  progDialog.Show()

  'Assume all Point Notes relate to insect infestation sites
  For Each insectSite As Note In Application.ActiveMapDisplay.Map.GetMapItems(Of Note)()

    If TypeOf insectSite.Graphic.Geometry Is ESRI.ArcGISExplorer.Geometry.Point Then

      'update the main progress dialog message
      progDialog.UpdateInstruction(String.Format("Processing {0} site", insectSite))

      Dim insectPnt As ESRI.ArcGISExplorer.Geometry.Point = DirectCast(insectSite.Graphic.Geometry, ESRI.ArcGISExplorer.Geometry.Point)

      'Perform a search to find all affected tree stands within 1 mile of each location
      Dim affectedTreeStands As RowCollection = standsTable.SearchByDistance(insectPnt, 1, Unit.Miles)

      'Process each affected tree stand
      For Each treeStand As Row In affectedTreeStands
        'update the secondary progress dialog message
        progDialog.UpdateMessage(String.Format("Analyzing {0} stand", treeStand.Values.Item("SCPTDATA_ID").ToString()))
        'Do some analysis or output results...
      Next

    End If

  Next

End Using

See Also