# Recursion Enabled Task Progress Dialog

This is an advanced progress dialog which can be shared among method calls which can call each other recursively. Each method call gets a portion of the total progress so we can see some continuous progress instead of only top level method progress.

This is implemented by singleton version of TaskProgress using static public member which each method can use without being aware of other methods. This component keeps tracks of call recursion in a Stack and allocates progress bar range to each of the calls. Also the point of interest is the time remaining calculation which, if not sure, would show min-max range like “Time Remaining: 2 mins to 7 mins”. Please note that this is .Net 2.0 Beta1 code.

Sample code for usage:


/*** Pseudo Code ***/
public void Button1_Click(...)
{
Progress.Show(0, 100);
Progress.AllocateRangeForCallee(0,25);    //child updates would be mapped to range 0 to 25
Callee1();  //Callee would also attempt to show progress dialog too
}

private void Callee1()
{
//this won't re-show, just increment the ref count
Progress.Show(0, 100);  //this range is mapped to what caller has allocated
...         //do work and update progress