cdbean04
Posts: 31
Joined: Thu May 28, 2015 3:28 pm
Location: Evansville Indiana

Multithreading/Async

Mon Sep 21, 2015 6:07 pm

Hi everybody,
am writing a windows universal app for my raspberry pi. I need this app to increment 25 separate text boxs starting at different intervals until they receive a stop signal. What do I need to use to get this accomplished. I have tried threading and have looked into using thread pool or async/await, but I am haveing no luck figuring out what to do. I am hoping someone can point me in the right direction.

haroldpulcher
Posts: 58
Joined: Tue Jun 09, 2015 8:08 pm
Contact: Website

Re: Multithreading/Async

Mon Sep 21, 2015 10:40 pm

I have never done this on a uwp applicatoin, but it is on my short list to try.

I would setup something like MVVM light:
http://blog.galasoft.ch/posts/2014/04/b ... vvm-light/

If you set the binding up, simply updating the model will trigger the screen to be updated. You really don't want to muck with the UI thread, and this does a ton of work for you.

Again I haven't tried this, but it should work

User avatar
jark
Posts: 17
Joined: Fri Aug 21, 2015 8:52 am
Contact: Website

Re: Multithreading/Async

Tue Sep 22, 2015 11:12 am

cdbean04 wrote:Hi everybody,
am writing a windows universal app for my raspberry pi. I need this app to increment 25 separate text boxs starting at different intervals until they receive a stop signal. What do I need to use to get this accomplished. I have tried threading and have looked into using thread pool or async/await, but I am haveing no luck figuring out what to do. I am hoping someone can point me in the right direction.
What's the actual use case for this? If you use a technique like mvvm it shouldn't matter how often you update the textboxes and there might be a better data model you could use.

I would personally start with something simple and just create 25 DispatcherTimers and see if there would be any problems with that. From there you can go an try different techniques to optimize and make it faster (like using a single loop).

Return to “Windows 10 for IoT”