Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This problem was more complex than I thought. I’ve worked a lot with this. I share what I found because I think my experiences with it could help later someone else too.</p> <p>I worked with the sensors through service classes: these classes update my VMs and in the VMs I use my DispatcherHelper to update these on the UI. I knew if I want to update UI bound properties in valuechanged events of the sensors I need to call this update in the eventhandler with a dispatcherhelper but what I did not know is how they behave if they are communicating with VMs instead of Views. When I started the app I had no problems with updating the UI if the sensors had new value. My only problem was in this case that if I wanted to deactivate (pressed windows button) and activate (pressed back button) my app, I had no exception, I did not lost my debug session but only got a black page with a „Resuming…” text and running progressbar and nothing happened. </p> <p>What I missed was a crossthread/accessing exception. If I do it with a UI bound data it throws an exception but in this case it did not.</p> <p>One other thing: the accelerometer (I had a version only working with the accelerometer) works with the emulator but on the device it does not. I think the emulator try to simulate the accelerator by giving back values, but not in a right way (without a threading issue). </p> <p><strong>Solution</strong></p> <p>If I update within an eventhandler on the UI thread (with my own DispatcherHelper) everything works fine. It is a good lesson learned, always pay attention when interacting with sensors and other layers/threads (VM,V).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload