This document is archived and information here might be outdated.  Recommended version.


IProgressDialogFactory Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Framework > ESRI.ArcGIS.Framework > Interfaces > IP > IProgressDialogFactory Interface
ArcGIS Developer Help

IProgressDialogFactory Interface

Provides access to a method that creates a progress dialog.

Product Availability

Available with ArcGIS Desktop.

Description

Instead of reporting the progress of an operation in the status bar, you can display a progress dialog box instead. The progress dialog box displays an animation and a step progress bar. The IProgressDialogFactory interface is used to create and display a new progress dialog box.

Members

Name Description
Method Create Creates a progress dialog.

Classes that implement IProgressDialogFactory

Classes Description
ProgressDialogFactory Progress Dialog Factory object.

Remarks

The following example shows how to use progress dialog.

You would get m_app from the hook in ICommand::OnCreate().

[C#]

//Create a CancelTracker.
ITrackCancel pTrackCancel = new CancelTrackerClass();

//Create the ProgressDialog. This automatically displays the dialog
IProgressDialogFactory pProgDlgFactory = new ProgressDialogFactoryClass();
IProgressDialog2 pProDlg = pProgDlgFactory.Create(pTrackCancel, m_app.hWnd) as IProgressDialog2;

//Set the properties of the ProgressDialog.
pProDlg.CancelEnabled = true;
pProDlg.Description = "This is counting to 100000.";
pProDlg.Title = "Counting...";
pProDlg.Animation = esriProgressAnimationTypes.esriDownloadFile;

//Set the properties of the Step Progressor.
IStepProgressor pStepPro = pProDlg as IStepProgressor;
pStepPro.MinRange = 0;
pStepPro.MaxRange = 100000;
pStepPro.StepValue = 1;
pStepPro.Message = "Hello";


//Step. Do your big process here.
bool bCont = true;
int i;
for (i = 0; i <= 100000; i++)
{
  m_app.StatusBar.set_Message(0, i.ToString());
  //Check if the cancel button was pressed. If so, stop process  
  bCont = pTrackCancel.Continue(); 
  if (!bCont)  
    break; 
}
pProDlg.HideDialog();

[Visual Basic .NET]

'Create a CancelTracker.
Dim pTrackCancel As ITrackCancel = New CancelTrackerClass()

'Create the ProgressDialog. This automatically displays the dialog
Dim pProgDlgFactory As IProgressDialogFactory = New ProgressDialogFactoryClass()
Dim pProDlg As IProgressDialog2 = TryCast(pProgDlgFactory.Create(pTrackCancel, m_app.hWnd), IProgressDialog2)

'Set the properties of the ProgressDialog.
pProDlg.CancelEnabled = True
pProDlg.Description = "This is counting to 100000."
pProDlg.Title = "Counting..."
pProDlg.Animation = esriProgressAnimationTypes.esriDownloadFile

'Set the properties of the Step Progressor.
Dim pStepPro As IStepProgressor = TryCast(pProDlg, IStepProgressor)
pStepPro.MinRange = 0
pStepPro.MaxRange = 100000
pStepPro.StepValue = 1
pStepPro.Message = "Hello"


'Step. Do your big process here.
Dim bCont As Boolean = True
Dim i As Integer
i = 0
While i <= 100000
 m_app.StatusBar.set_Message(0, i.ToString())
 'Check if the cancel button was pressed. If so, stop process  
 bCont = pTrackCancel.[Continue]()
 If Not bCont Then
  Exit While
 End If
 System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
End While
pProDlg.HideDialog()

 

See Also

IProgressDialog2 Interface | IStepProgressor Interface