Пример #1
0
 public void AddPoint(MyPoint point)
 {
     this.ListPoints.Add(point);
 }
Пример #2
0
        // lấy thông tim điểm hiện tại
        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            btnSave.IsEnabled = false;
            processBar.Visibility = Visibility.Visible;
            String currentP = "";
            await GetCurrentLocation();
            MapLocationFinderResult result = await MapLocationFinder.FindLocationsAtAsync(CurrentPoint);
            if (result.Status == MapLocationFinderStatus.Success)
            {
                MyPoint myPoint = new MyPoint
                {
                    Name = result.Locations[0].Address.StreetNumber + " "
                           + result.Locations[0].Address.Street + ", "
                           + result.Locations[0].Address.District + ", "
                           + result.Locations[0].Address.Town,
                    Long = CurrentPoint.Position.Longitude + "",
                    Lat = CurrentPoint.Position.Latitude + ""
                };


                _data.AddPoint(myPoint);
                currentP = myPoint.Name;
            }

            MapIcon mapIcon = new MapIcon
            {
                Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/image/map_marker.png")),
                Title = currentP,
                Location = CurrentPoint,
                NormalizedAnchorPoint = new Point(0.5, 0.5)
            };
            MyMap.MapElements.Add(mapIcon);

            processBar.Visibility = Visibility.Collapsed;
            btnSave.IsEnabled = true;
            ShowToast(main, "Tap to item for edit/delete");

        }