protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); // Navigate to new destination if (e.NavigationMode == NavigationMode.New) { LatLong destination; LatLong.TryParse(e.Parameter as String, out destination); GotoLocation(destination, showMessage: !_firstRun); } else { // refresh the point-of-interest list given coordinates saved in page state. Note that Refresh is async, but // we are not awaiting it to lessen risk that a resume operation will timeout if (_pageState.MapBox != null) { LeftPanel.Refresh(_pageState.MapBox, _pageState.SelectedItemId); } // reset map to last known view TheMap.SetView(new Location(_pageState.MapCenter.Latitude, _pageState.MapCenter.Longitude), _pageState.Zoom, MapAnimationDuration.None); } DataTransferManager dtm = DataTransferManager.GetForCurrentView(); dtm.DataRequested += LeftPanel.GetSharedData; }
/// <summary> /// Fires when map panning is complete, and the current bounds of the map can be accessed to apply the points of interest /// (note that using TargetBounds in lieu of the event handler led to different results for the same target location depending ont /// the visibilty of the map at the time of invocation - i.e., a navigation initiated from the search results pages reported sligthly /// offset TargetBounds /// </summary> async void TheMap_ViewChangeEndedWithRefreshNeeded(object sender, ViewChangeEndedEventArgs e) { // refresh the left panel to reflect points of interest in current view await LeftPanel.Refresh(new BoundingBox(TheMap.TargetBounds.North, TheMap.TargetBounds.South, TheMap.TargetBounds.West, TheMap.TargetBounds.East)); // unregister the handler TheMap.ViewChangeEnded -= TheMap_ViewChangeEndedWithRefreshNeeded; }
private async void Refresh_Click(object sender, RoutedEventArgs e) { await LeftPanel.Refresh(new BoundingBox(TheMap.TargetBounds.North, TheMap.TargetBounds.South, TheMap.TargetBounds.West, TheMap.TargetBounds.East)); }