Create progress bar in dynamics ax part3


Description:-

Use SysOperationProgress class to show the progress BarsInitialize a SysOperationProgress variable.

Set a caption for the form by using the SysOperationProgress.SetCaption method. Set an animation to run while the operation is in progress by using the SysOperationProgress. SetAnimation method.

A number of animations are provided with Microsoft Dynamics AX. To view them, run the Tutorial_ShowAVIFiles class. If you use one of these animation files, you need to declare the AviFiles macro at the top of your code.

Specify the total number of operation steps.

This is needed for the time-remaining calculation. If you do not set the total number of operation steps, the progress indicator is not shown. The total is often a count of the number of records, and may be time-consuming to calculate. Don't specify the total if the time is taken to calculate the records is comparable to the total time taken for the operation.

Perform the operation. For each step, specify a description and a step number.

During the execution, the progress indicator is updated accordingly. The estimated time remaining is calculated and displayed.

The default update interval is 3 seconds. If the task of updating the display takes more than 10% of the update interval due to latency on the network connection, the update interval is increased by 1 second.

Example :-

static void operationProgress_progressBars(Args _args)
{
  #AviFiles
  SysOperationProgress progress = new SysOperationProgress();
  int i;
  ;
  progress.setCaption("Progress bar example…");
  progress.setAnimation(#AviUpdate);
  progress.setTotal(50000);
  for (i = 1; i <= 50000; i++)
  {
     progress.setText(strfmt("The value of i is %1", i));
     progress.setCount(i, 1);
  }
}

Related Posts

Previous
Next Post »

Thanks for comments.....