N
nidhig
Hi
I am trying to implement the Abort functionality in progress bar
control. Scenario is like this.
I have a web application which performs a very long computation
process. This computation process starts when I click calculate button
on that webworm.
On Calculate click two functionalities are implemented
1)When I click on calculate it open a progress bar pop up .This
progress bar uses JavaScript to update the status and filling up of
span to show the percentage complete
2)Also a request is being posted on to perform a long computation.
During this long wait ,if user wants to abort the computation he has to
clcik on Abort button provided on progress bar pop up. In this Abort
button functionality I call the function on main page to abort this
request. Limitations I face here are
1)This abort request is processed after computation request is
complete. So it 's of no use.
2)I used thread here to avoid this problem. But limitations I face here
are
a)My calculation process includes three steps Maping data from screen,
Perform calculations on that mapped data, Bind the calculations with
screen.
b)All the three functions described above should occur synchronously.
c)Thread method to be executed when thread starts is "Perform
calculations"
d)"BindData' function is dependent on Perform Calculations
I cannot put MapData() and BinData() in thread , as thread throws null
reference exception. It never gets the context.
Please tell me where I am going wrong or suggest a new approach to
resolve the problem.
pseudo code for help
bool ThreadCompleted = false;
protected void btnCompute_Click(sender,event Args)
{
MapDataFromScreen();
workerStart = new ThreadStart(PerformAnalysis);
workerThread = new Thread(workerStart);
workerThread.Start();
BindData();
}
private void PerformAnalysis
{
//Perform long calculations
ThreadCompleted = true;
}
private void BindData()
{
if(ThreadCompleted)
{
//Bind Grid and labels with new calculations
}
}
//This event does not get called unless the Bind Data function is
complete.How to avoid this??
protected void Abort()
{
workerThread.Abort();
}
Can some body help me on this..??
I am trying to implement the Abort functionality in progress bar
control. Scenario is like this.
I have a web application which performs a very long computation
process. This computation process starts when I click calculate button
on that webworm.
On Calculate click two functionalities are implemented
1)When I click on calculate it open a progress bar pop up .This
progress bar uses JavaScript to update the status and filling up of
span to show the percentage complete
2)Also a request is being posted on to perform a long computation.
During this long wait ,if user wants to abort the computation he has to
clcik on Abort button provided on progress bar pop up. In this Abort
button functionality I call the function on main page to abort this
request. Limitations I face here are
1)This abort request is processed after computation request is
complete. So it 's of no use.
2)I used thread here to avoid this problem. But limitations I face here
are
a)My calculation process includes three steps Maping data from screen,
Perform calculations on that mapped data, Bind the calculations with
screen.
b)All the three functions described above should occur synchronously.
c)Thread method to be executed when thread starts is "Perform
calculations"
d)"BindData' function is dependent on Perform Calculations
I cannot put MapData() and BinData() in thread , as thread throws null
reference exception. It never gets the context.
Please tell me where I am going wrong or suggest a new approach to
resolve the problem.
pseudo code for help
bool ThreadCompleted = false;
protected void btnCompute_Click(sender,event Args)
{
MapDataFromScreen();
workerStart = new ThreadStart(PerformAnalysis);
workerThread = new Thread(workerStart);
workerThread.Start();
BindData();
}
private void PerformAnalysis
{
//Perform long calculations
ThreadCompleted = true;
}
private void BindData()
{
if(ThreadCompleted)
{
//Bind Grid and labels with new calculations
}
}
//This event does not get called unless the Bind Data function is
complete.How to avoid this??
protected void Abort()
{
workerThread.Abort();
}
Can some body help me on this..??