/// <summary> /// Does what the function name states. /// /// Because Map Markers are child elements of the MapControl, they cannot be a natural /// anchor point for the flyout to display. Thus we need to manually anchor the flyout /// based on the marker pressed. /// </summary> private static void ShowFlyoutAboveMapMarker(MapControl sender, Stop stop, MenuFlyout flyout) { var stopGeo = new BasicGeoposition { Latitude = stop.Lat, Longitude = stop.Long }; Point markerPoint; sender.GetOffsetFromLocation(new Geopoint(stopGeo), out markerPoint); flyout.ShowAt(sender, markerPoint); }
private bool AreLocationsTheSame(Stop s, Geopoint location) { return Math.Abs(s.Lat - location.Position.Latitude) < 0.001 && Math.Abs(s.Long - location.Position.Longitude) < 0.001; }
/// <summary> /// Displays the Arrivals Flyout, anchored to the pressed map marker. /// </summary> private void ShowArrivalMenu(MapControl sender, Stop stop, Dictionary<int, Dictionary<string, int>> arrival) { int eta; if (!arrival[stop.ID].TryGetValue(SelectedRoute.RouteNo, out eta)) { // Sweep this problem under the rug. return; } stop.ETA = eta; ETAItem.Text = stop.ETADisplayText; var flyout = FlyoutBase.GetAttachedFlyout(RootSplitView) as MenuFlyout; if (flyout != null) { ShowFlyoutAboveMapMarker(sender, stop, flyout); } // Set this here so that Launching Maps for directions has the most current stop. SelectedStop = stop; }