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       
    Progress.Unload();      //ref count =0, this will actually unload 

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       
    Progress.Unload();  // this won't actually unload, just decrement the ref count 

Warning: This program was written circa Mar 2004 and last updated around Mar 2005. It is currently considered obsolete. There are no plans to update it and no support is provided.

TaskProgressDialog is now archived at Github

Shital Shah

A program trying to understand what it’s computing.

comments powered by Disqus