I wish to use System.Threading on my monogame project. I have it working on Windows and Android, but on Windows Store apps i’m getting stuck in dependencies.
Visual Studio Says:
The type or namespace name 'Thread' could not be found (are you missing a using directive or an assembly reference?)
If I try and add a reference to System.Threading. I get the following messagebox:
The type the compiler complains about is just Thread.
Does any knows how I can use Threading on windows store apps?
Apparently Windows Store apps don’t support low level threading provided by System.Threading.Thread. They do support Either Task or BackgroundWorker. I choose BackgroundWorker because its fairly easy to set up and for basic “processing data while showing a progress indicator” scenarios it has you covered.! I can also confirm that it will work on: Windows, Windows Store, Android, Mac and IOS.
I was surprised too. But technically it support “threading” but just not the low level Thread class. It only support managed types. I personally like BackgroundWorkder the best! Also its from .net 2.0. So low version dependency! Task (factory.startnew()) is from .net 4.0. Also task seems very abstract and just a complicated way of using the ThreadPool. Where BackgroundWorker just gives me what I want… That’s running a function in a separate thread and an easy API for handeling progress.
But then the only way of getting it in the Windows Store is thru Microsoft Desktop Brige.! Seems like an unnecessary action when you can just change to BackgrounWorker or Task.