Background task with huge data and progress bar

Hi Expert,
I have a background task which do lenghtly calculatio, how can I connect
my backgound task to GUI,and accept cancel button command?
I am using Vs2010, and TPL for creating task.

Thanks,
JT
jtran007Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dericstoneCommented:
Oh, and about the cancel button, this code should give you an idea how to get started.
private bool isCancelButtonPressed = false;        
 
        private void myCancelBtn_Click(object sender, EventArgs e)
        {
          isCancelButtonPressed = true;
        }
...
 
        private void DoProcess()
        {
          for (int progress = 0; progress < 100; )
          {
            // Do a little work here 

            // Update the variable progress here depending on how much work was done

            UpdateProgressBarMethod(progress);

            if (isCancelButtonPressed)
              break;
          }
        }

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jtran007Author Commented:
Hi Expert,

Sionce I use Task Parallel Library to do background task. How can I setup the GUI task talk to
TPL task?

Thanks,
JT
0
jtran007Author Commented:
Thanks,
JT
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.