示例#1
0
        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>.
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session. The state will be null the first time a page is visited.</param>
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            if (e.NavigationParameter != null)
            {
                var icon = e.NavigationParameter as MapIcon;

                if (icon != null)
                {
                    CreatePivotItem(MapExtensions.GetValue(icon));
                }
            }
        }
示例#2
0
 /// <summary>
 /// Navigates to details page for the selected place
 /// </summary>
 /// <param name="sender">The sender of the event</param>
 /// <param name="args">Provides data about user input for the map tapped</param>
 private void OnTapped(MapControl sender, MapInputEventArgs args)
 {
     try
     {
         var elementList = PlacesMap.FindMapElementsAtOffset(args.Position);
         foreach (var element in elementList)
         {
             var mapIcon = element as MapIcon;
             if (mapIcon != null)
             {
                 Place place     = MapExtensions.GetValue(mapIcon);
                 var   frame     = Window.Current.Content as Frame;
                 var   resultStr = place.Kind + "\n" + place.Position.Latitude.ToString() + "\n" + place.Position.Longitude.ToString() + "\n" +
                                   place.Radius.ToString() + "\n" + place.LengthOfStay.ToString() + "\n" + place.TotalLengthOfStay.ToString() + "\n" + place.TotalVisitCount.ToString();
                 this.Frame.Navigate(typeof(PivotPage), resultStr);
                 break;
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }