locked
Compass crashes RRS feed

  • Question

  • Hello Everybody !

    I'm using a compass for scrolling a scrollviewer.

    The problem is that the compass crashes everytime when the scroll is done with no error message.

    Here is my code : 

            private async void ReadingChanged(object sender, CompassReadingChangedEventArgs e)
            {
    
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,() =>
                {
                    
                    CompassReading reading = e.Reading;
                        scroller.ChangeView(reading.HeadingMagneticNorth * 10, 0d, null);
    
                });
            }

    Any ideas to fixe it?

    Thanks

    Friday, February 6, 2015 4:08 PM

Answers

  • Hi DiddyRennes,

    >>The problem is that the compass crashes everytime when the scroll is done with no error message.

    In my experience, the ReadingChanged event would be triggered frequently, you tried to load a new view into the viewport on the UI thread in this method, this thread would be too busy.

    To verify my suggestion, you could use DispatcherTimer to call ChangeView method periodically, if you set the interval to a very small value, check that if this will reproduce this issue.

    If this is the root cause, I would suggest you creating a logic to avoid invoke the method too frequently.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by DiddyRennes Monday, February 9, 2015 10:45 AM
    Monday, February 9, 2015 8:19 AM

All replies

  • Hi DiddyRennes,

    >>The problem is that the compass crashes everytime when the scroll is done with no error message.

    In my experience, the ReadingChanged event would be triggered frequently, you tried to load a new view into the viewport on the UI thread in this method, this thread would be too busy.

    To verify my suggestion, you could use DispatcherTimer to call ChangeView method periodically, if you set the interval to a very small value, check that if this will reproduce this issue.

    If this is the root cause, I would suggest you creating a logic to avoid invoke the method too frequently.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by DiddyRennes Monday, February 9, 2015 10:45 AM
    Monday, February 9, 2015 8:19 AM
  • Thanks very much It worked
    Monday, February 9, 2015 10:45 AM