Assembly: ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public sealed class ProgressHelper : IDisposable |
Visual Basic (Declaration) |
---|
Public NotInheritable Class ProgressHelper _ Implements IDisposable |
Remarks
The ProgressHelper class allows you to display a progress dialog to the user while the applications is working. The dialog is similar in style to the progress dialogs used by the application itself, helping to maintain a consistent look and feel in add-ins. Several update methods on the ProgressHelper class allow you to develop a progress dialog with informative progress information.
The ProgressHelper is designed for use by blocking operations on the user interface thread. For example the application shows a progress dialog while the view is switched from 2D to 3D mode, as the user is unable to interact with the application while the switch is taking place. It is not suitable for use from a worker thread.
Examples
//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... } } } }
'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