예제 #1
0
 private async void BtnZoomToOriginOnClick(object sender, RoutedEventArgs e)
 {
     if (CurrentLocation != null)
     {
         if (CanberraMap.ZoomLevel < 15)
         {
             await CanberraMap.TrySetViewAsync(CurrentLocation, 15);
         }
         else
         {
             await CanberraMap.TrySetViewAsync(CurrentLocation);
         }
     }
 }
예제 #2
0
 private async void GeolocationPositionUpdated(Geoposition position, GeolocationService.PositionUpdateReasons reason)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                               async() =>
     {
         if (position != null)
         {
             await CanberraMap.TrySetViewAsync(position.Coordinate.Point, 18);
             if (_locationPin == null)
             {
                 _locationPin       = new MapIcon();
                 _locationPin.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/me.png"));
                 //  _locationPin.NormalizedAnchorPoint = new Point(0.5, 1.0);
                 _locationPin.ZIndex = 0;
                 CanberraMap.MapElements.Add(_locationPin);
             }
             _locationPin.Location = position.Coordinate.Point;
         }
     });
 }