windows runtime - MapControl differentiate between user or programmatic center change -
In WinRt / WP 8.1 MapControl, how can I differentiate between users when a user changes a programmatic change in the middle of the screen ?
WinRt / WP 8.1 is a center-playful event in MapControl (), but it does not provide any information about what causes the center change.
Is there any other way to know if a user has changed Map Center?
/ * To give more context, my typical scenario is as follows:
App which shows a map, I track a user's GPS position Want to do
- If a GPS position is detected, then I want to put a point on the map and focus on the map at that point.
- If a GPS position is changed, then I want to focus the map at that point.
- If the user changes map status by contact / swipe, then I no longer want to focus the map when changing GPS position.
I can hack it by comparing GPS position, but it's a different type of latLng GPS position; Accurate as map. Center latLng I wanted to like a simple, low solution * /
I call it a bool UnselectedJustViewport Changes
is set by setting to correct
before trying TrySetViewAsync
and after the async operation reset it to false
Please.
In the event handler, I immediately break the routine Ignore the next frontend change
is still true.
So in the end, it looks like:
If you have a case that the Setcenter can be called in parallel twice (so that the last call for SetCenter
does not end, but SetCenter is renamed to
), you may have to use a counter:
int viewportChangesInprogressCounter; Public Zero HandleMapCenterChanged () {Map.CenterChanged + = (Sender, Args) = & gt; {If Viewport Changes progress control> 0) returned; // If you have come here, the user has changed the location. // Store this information elsewhere and leave the SetCenter next time}} Public Assoc zero set center {viewportChangesInprogressCounter ++; Wait. TriSetViewsink (new Geopoint (center)); ViewportChangesInProgressCounter--; }
Comments
Post a Comment