I have developed a .net library for XInput using P/invoke, and am now getting ready to implement it into a gui (WPF).
I have had a look at the BackgroundWorker class, and have got it working as a test for 1 controller, but its a hack job and clearly it wouldn't be suitable for 2-4 controllers (this was mainly done to see what I needed to do with the gui).
So I'm asking some more of the experienced people here, on how to approach the threading in this app. Should I continue with the BackgroundWorker class or look at TPL in .net 4, or some other method?
The worker thread is required as there is no messaging system for XInput, only a polling system. The worker thread would check input roughly every 20ms or something like that (Thread.Sleep). I am also not sure if there should be only 1 worker thread for all controllers or 4 worker threads (there is a max controller limit of 4).
I'm a bit new to WPF and .NET in general, so any advice welcome :)