I have a pretty long running process which now freezes my application for a while.
How can i wrap this process in a backgroundworker and provide the user with a status.
I know that ideally the process itself would have to report its progress, but i dont think i can build that in. It’s not that i cannot change the code in that process, but i dont want to change it too much.
I would be nice if i could start the process in a backgroundworker so that my app stays responsive. Now this i can do. But the question is, is there an easy way to have some progressbar doing something to indicate that the process is still running?
private void worker_DoWork(object sender, DoWorkEventArgs e)
{
StartLongRunningProcess();
}
My code is now like the above, and i was wondering how to wrap the process in some way that i can update a progressbar? Or is there an easy way to get some more information from this process without completely changing it’s code? Inside that long running process there is a modified row counter running, but it only return a value when it’s finished.
I know how the backgroundworker and it’s ReportProgress options work, but the problem is that the process just runs and doesn’t provide any feedback while running.
If you set the WorkerReportsProgress property to true you can then use the ProgressChanged event.
Then in your do work you can report the progress.
You can find the full example here