0

I have a GUI window in my application, where user does his stuff, and in this window he can trigger a function which will start converting couple of files. Since this conversion takes eons, I can't simply execute it in the same thread, since the the entire window would be frozen, until the conversion code let's it go, after it finishes.

What is the best solution here? Should I just execute the conversion code in a separate thread?

Something like TaskFactory.StartNew? Is that the best path to follow? (I like this solution, but it would be nice, if I could set the task priority to low so other apps in the PC won't lag during the conversion)

user3595338
  • 737
  • 3
  • 11
  • 26
  • When you spin off a new thread, does it in fact cause other apps to hang because it's just that intense of a thread? – Brad Jun 24 '14 at 14:58
  • Actually it's a file selection dialog and when the selection is done I just loop it up with new TaskFactory.StartNew for each file. This is of course merely ugly placeholder solution. – user3595338 Jun 24 '14 at 15:07
  • http://stackoverflow.com/questions/3836584/lowering-priority-of-task-factory-startnew-thread – Ihor Deyneka Jun 24 '14 at 15:28
  • You could use a `BackgroundWorker` and you could report progress to the user as the files are completed. – Tyler Jun 24 '14 at 15:31

0 Answers0