I was wondering whether Background thread are really helpful if i need to update my GUI regularly (quite often in my case) ?? I’m working on a WPF (C#) app. While opening an old project file I’ve done all processing on background thread, However GUI shows progress and needs to be refreshed regularly.
So does background thread will really help in this case. What if i move this processing to main thread (as ever otherwise i’m not doing anything, just waiting for file to load) ?
Found !! Thanks,
Well, one thing to consider is not updating the progress quite as often. Is the user going to notice the difference between updating it 100 times a second and updating it 10 times a second? You might want to batch the updates. Having said that, unless the updates are actually becoming problematic in terms of performance, I wouldn’t take the complexity hit.
However, if you’re doing a significant amount of work you should absolutely have it in a background thread. Otherwise your UI will become unresponsive while that work is carrying on – and depending on some details, the progress updates might not even show at all!
Even though your code may not be doing anything else, the UI thread still wants to be able to respond to events – mouse movements etc.