Пример #1
0
        private void RouteMapControl_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var geoPoint   = args.Location;
            var clickedLat = geoPoint.Position.Latitude;

            clickedLat = Math.Truncate(100 * clickedLat) / 100; //Math.Round(clickedLat, 3);
            var clickedLong = geoPoint.Position.Longitude;

            clickedLong = Math.Truncate(100 * clickedLong) / 100;//Math.Round(clickedLong, 3);
            if (thisRoute.StartPosition.Point.Latitude.ToString().Contains(clickedLat.ToString()) && thisRoute.StartPosition.Point.Longitude.ToString().Contains(clickedLong.ToString()))
            {
                VisitSpeedBlock.Text = thisRoute.StartPosition.VisitSpeed.ToString();
                VisitTimeBlock.Text  = thisRoute.StartPosition.VisitedTime.ToString();
            }
            if (thisRoute.EndPosition.Point.Latitude.ToString().Contains(clickedLat.ToString()) && thisRoute.EndPosition.Point.Longitude.ToString().Contains(clickedLong.ToString()))
            {
                VisitSpeedBlock.Text = thisRoute.EndPosition.VisitSpeed.ToString();
                VisitTimeBlock.Text  = thisRoute.EndPosition.VisitedTime.ToString();
            }
            if (thisRoute.MarkedPositions != null)
            {
                foreach (var pos in thisRoute.MarkedPositions)
                {
                    if (pos.Point.Latitude.ToString().Contains(clickedLat.ToString()) && pos.Point.Longitude.ToString().Contains(clickedLong.ToString()))
                    {
                        VisitSpeedBlock.Text = pos.VisitSpeed.ToString();
                        VisitTimeBlock.Text  = pos.VisitedTime.ToString();
                    }
                }
            }
        }
Пример #2
0
        private void MainMap_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            SES.Clear();
            var school = KnownSchools.Find(n => n.Name.Equals(args.MapElements[0].Tag));

            SES.Add(school);
        }
Пример #3
0
        private async void movieMap_MapElementClick(MapControl sender,
                                                    MapElementClickEventArgs args)
        {
            MapIcon topMost = args.MapElements[0] as MapIcon;

            if (topMost.Title == "Lots of Movie Spots")
            {
                if (movieMap.ZoomLevel < 16)
                {
                    //await movieMap.TrySetViewAsync(args.Location, 16);
                    await movieMap.TrySetSceneAsync(
                        MapScene.CreateFromLocationAndRadius(args.Location, 500, 45, 50));
                }
                else
                {
                    await movieMap.TrySetViewAsync(args.Location, movieMap.ZoomLevel + 2);
                }
            }
            else
            {
                MovieInfoPanel infoPanel = new MovieInfoPanel
                {
                    ClickedLocation = topMost.Location
                };
                infoPanel.Closed += infoPanel_Closed;
                movieMap.Children.Add(infoPanel);

                MapControl.SetLocation(infoPanel, topMost.Location);
            }
        }
Пример #4
0
        private void OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var mapIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            if (mapIcon != null)
            {
                // TODO:
                // if it's for the same pin, hide it
                // if it's for a different pin, switch it out

                if (!_overlayShown)
                {
                    var customPin = GetCustomPin(mapIcon.Location);

                    _overlay = new CluePushpinOverlay()
                    {
                        Title = customPin.FormsPin.Label
                    };
                    _overlay.Click += (o, e) => customPin.OnClicked();

                    _nativeMap.Children.Add(_overlay);
                    MapControl.SetLocation(_overlay, mapIcon.Location);
                    MapControl.SetNormalizedAnchorPoint(_overlay, new Windows.Foundation.Point(0.5, 1.0));
                    _overlayShown = true;
                }
                else
                {
                    _nativeMap.Children.Remove(_overlay);
                    _overlayShown = false;
                }
            }
        }
Пример #5
0
 private void MainMap_MapElementClick(MapControl sender, MapElementClickEventArgs args)
 {
     foreach (var addin in AddIns)
     {
         addin.OnMapElementsClicked(args.MapElements.Intersect(addin.MapElementsShown), args.Location.ToLatLon(), args.Position);
     }
 }
Пример #6
0
        private void mapView_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            BasicGeoposition locationIcon      = args.Location.Position;
            ArrayList        listNumberWarning = new ArrayList();
            var warningI = 1;

            warningsTB.Text = "";

            foreach (PuntoBing puntoBing in puntos)
            {
                if (puntoBing.Latitude == Math.Round(locationIcon.Latitude, 5) && puntoBing.Longitude == Math.Round(locationIcon.Longitude, 5))
                {
                    latitudTB.Text   = puntoBing.Latitude.ToString();
                    longitudTB.Text  = puntoBing.Longitude.ToString();
                    distanciaTB.Text = puntoBing.Distancia.ToString();
                    tiempoTB.Text    = puntoBing.Tiempo.ToString();
                    foreach (var signal in puntoBing.Signs)
                    {
                        signalsTB.Text = signalsTB.Text + Environment.NewLine + signal.ToString();
                    }

                    foreach (var warning in puntoBing.Warnings)
                    {
                        warningItems.Add(warning as Warning);
                        listNumberWarning.Add("Advertencia: " + warningI);
                        warningI++;
                    }
                    warningsCB.ItemsSource = listNumberWarning;
                }
            }
        }
Пример #7
0
        private void MapControl1_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var map = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            var parking = ((ViewModel.PocetnaViewModel) this.DataContext).Parkinzi.ToList().Find(p1 => (Math.Abs((p1.GeoSirina - map.Location.Position.Longitude)) < 0.001) && (Math.Abs((p1.GeoDuzina - map.Location.Position.Latitude)) < 0.001));

            var parkingRezervacija = ((ViewModel.PocetnaViewModel) this.DataContext).ParkinziRezervacije.ToList().Find(p1 => (Math.Abs((p1.GeoSirina - map.Location.Position.Longitude)) < 0.001) && (Math.Abs((p1.GeoDuzina - map.Location.Position.Latitude)) < 0.001));

            popUp.Visibility = Visibility.Visible;

            if (parking != null)
            {
                ((ViewModel.PocetnaViewModel) this.DataContext).Parking = parking;
                parkingElement.AdresaTextBlock    = parking.Adresa;
                parkingElement.CijenaTextBlock    = parking.DajCijenu;
                parkingElement.RatingP            = parking.Prosjek;
                parkingElement.KapacitetTextBlock = parking.KapacitetP;
                rezervisiButton.IsEnabled         = false;
                ((ViewModel.PocetnaViewModel) this.DataContext).UkupnaCijena = " " + parking.DajCijenu;
            }
            else
            {
                //((ViewModel.PocetnaViewModel)this.DataContext).ParkingRezervacija = parkingRezervacija;
                PocetnaViewModel.ParkingRezervacija = parkingRezervacija;
                parkingElement.AdresaTextBlock      = parkingRezervacija.Adresa;
                parkingElement.CijenaTextBlock      = parkingRezervacija.DajCijenu;
                parkingElement.RatingP            = parkingRezervacija.Prosjek;
                parkingElement.KapacitetTextBlock = parkingRezervacija.KapacitetP;
                rezervisiButton.IsEnabled         = true;
                ((ViewModel.PocetnaViewModel) this.DataContext).UkupnaCijena = " " + parkingRezervacija.DajCijenu;
            }
        }
Пример #8
0
 private async void myMap_MapElementClick_1(MapControl sender, MapElementClickEventArgs args)
 {
     try
     {
         foreach (MapElement me in args.MapElements)
         {
             if (this.ViewModel.MapElementsCollection.Contains(me))
             {
                 ContentDialog CrimeDetails = new ContentDialog()
                 {
                     Title           = "Crime Details",
                     Content         = me.Tag.ToString(),
                     CloseButtonText = "Done"
                 };
                 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                 {
                     try
                     {
                         await CrimeDetails.ShowAsync();
                     }
                     catch (Exception ex)
                     {
                         Debug.WriteLine(ex.Message);
                     }
                 });
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
        private void map_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            try
            {
                MapIcon ıcon     = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;
                string  iconName = ıcon.Title;

                Place place = new Place();

                for (int i = 0; i < stationList.Count; i++)
                {
                    if (iconName == stationList[i].name)
                    {
                        place = stationList[i];
                        break;
                    }
                }

                findPlacebyId(place.place_id);
            }

            catch (Exception)
            {
            }
        }
        private void MapControl_OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var      clickedIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;
            Location location;

            try
            {
                location = _locationMarkers[_locationMarkerIcons[clickedIcon]];
            }
            catch (KeyNotFoundException)
            {
                return;
            }

            if (_currentTappedLocation != null)
            {
                if (location.Id == _currentTappedLocation.Id)
                {
                    LocationMarkerDetails_OnTapped(MapControl, null);
                }
            }

            IsLocationFree.Text      = location.GetPriceText();
            LocationTypeIcon.Source  = location.GetLocationIcon();
            LocationName.Text        = location.Name;
            LocationCoordinates.Text = location.GetCoordinatesAsString();
            Rating.Text = location.GetRating();
            LocationMarkerDetails.Visibility = Visibility.Visible;

            _currentTappedLocation = location;
        }
Пример #11
0
        //METODO PARA MOSTRAR EL RECUADRO CON LA INFO DE LA GASOLINERA EN EL MAPA, AL DAR CLICK AL PIN
        private void OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var mapicon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            if (mapicon != null)
            {
                if (!IsFuelStationWindowVisible)
                {
                    //MANDA LOS DATOS DE LA GASOLINERA AL MAPWINDOW PARA MOSTRAR EL RECUEADRO CON LA INFO
                    if (FuelStationWindow == null)
                    {
                        FuelStationWindow = new MapWindow(FuelStation);
                    }
                    var position = new BasicGeoposition
                    {
                        Latitude  = FuelStation.Latitude,
                        Longitude = FuelStation.Longitude
                    };
                    var point = new Geopoint(position);

                    NativeMap.Children.Add(FuelStationWindow);
                    MapControl.SetLocation(FuelStationWindow, point);
                    MapControl.SetNormalizedAnchorPoint(FuelStationWindow, new Windows.Foundation.Point(0.5, 1.0));

                    IsFuelStationWindowVisible = true;
                }
                else
                {
                    NativeMap.Children.Remove(FuelStationWindow);

                    IsFuelStationWindowVisible = false;
                }
            }
        }
Пример #12
0
        //listener for icon clicks
        private void mapIcon_Click(MapControl sender, MapElementClickEventArgs args)
        {
            //find which icon element has been clicked
            MapIcon clickedIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            string long_name = clickedIcon.Title;


            //if user hasnt clicked his location icon
            if (!clickedIcon.Title.Contains("You are here"))
            {
                //loop through busStopData
                for (int i = 0; i < busStopData.Length; i++)
                {
                    //find stop_ref
                    if (clickedIcon.Title == busStopData[i].long_name)
                    {
                        //stop_ref = busStopData[i].stop_ref;
                        makeDepartureTimes(busStopData[i].stop_ref);
                        break;
                    }
                }
            }
            else //user location was clicked
            {
                showMessage(clickedIcon.Title);
            }
        }
Пример #13
0
        private void RoutePlanMapControl_OnMapElementClick(MapControl mapControl, MapElementClickEventArgs args)
        {
            _mapIconClicked = true;

            List <MapElement> mapElements = args.MapElements.ToList();

            if (!(mapElements.FirstOrDefault() is MapIcon mapIcon))
            {
                return;
            }

            int indexOf = mapControl.MapElements.IndexOf(mapIcon);

            if (indexOf == -1)
            {
                return;
            }

            Customer customer = _viewModel.Customers[indexOf];

            ShowFlyout(mapIcon, customer);

            ListView.SelectedIndex = indexOf;
            ListView.ScrollIntoView(customer);
        }
Пример #14
0
 private async void maps_MapElementClick(MapControl sender, MapElementClickEventArgs args)
 {
     var location = args.Location.Position;
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         //if (maps.ZoomLevel < 15)
         //{
         //    maps.StartContinuousZoom(2);
         //    maps.ZoomLevelChanged += (ss, ee) =>
         //    {
         //        if (maps.ZoomLevel >= 15)
         //        {
         //            maps.StopContinuousZoom();
         //        }
         //    };
         //    if (ElementClickEvent != null)
         //    {
         //        ElementClickEvent(sender, new MapElementClickItemEventArgs() { args = args, isMaxZoom = false });
         //    }
         //}
         //else
         //{
         //    if (ElementClickEvent != null)
         //    {
         //        ElementClickEvent(sender, new MapElementClickItemEventArgs() { args = args, isMaxZoom = true });
         //    }
         //}
         ElementClickEvent(sender, new MapElementClickItemEventArgs()
         {
             args = args, isMaxZoom = true
         });
     });
 }
        private void OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var mapIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            if (mapIcon != null)
            {
                if (xamarinOverlayShown)
                {
                    nativeMap.Children.Remove(mapOverlay);
                    xamarinOverlayShown = false;
                }
                var customPin = GetCustomPin(mapIcon.Location.Position);
                if (customPin == null)
                {
                    throw new Exception("Custom pin not found");
                }

                mapOverlay = new XamarinMapOverlay(customPin);


                var snPosition = new BasicGeoposition {
                    Latitude = customPin.Position.Latitude, Longitude = customPin.Position.Longitude
                };
                var snPoint = new Geopoint(snPosition);

                nativeMap.Children.Add(mapOverlay);
                MapControl.SetLocation(mapOverlay, snPoint);
                MapControl.SetNormalizedAnchorPoint(mapOverlay, new Windows.Foundation.Point(0.5, 1.0));
                xamarinOverlayShown = true;
            }
        }
Пример #16
0
        private void MapElement_Click(object sender, MapElementClickEventArgs e)
        {
            var mapIconCity = e.MapElements.FirstOrDefault() as MapIcon;
            var city        = _cities.Where(c => c.Name == mapIconCity.Title).FirstOrDefault();

            Frame.Navigate(typeof(CityView), city);
        }
        private void OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var mapIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            if (mapIcon != null)
            {
                if (!markerWindowShown)
                {
                    if (markerWindow == null)
                    {
                        markerWindow = new MarkerWindow(Siniestros);
                    }

                    var snPosition = new BasicGeoposition
                    {
                        Latitude  = Double.Parse(Siniestros.Latitude),
                        Longitude = Double.Parse(Siniestros.Longitude)
                    };
                    var snPoint = new Geopoint(snPosition);

                    nativeMap.Children.Add(markerWindow);
                    MapControl.SetLocation(markerWindow, snPoint);
                    MapControl.SetNormalizedAnchorPoint(markerWindow, new Windows.Foundation.Point(0.5, 1.0));

                    markerWindowShown = true;
                }
                else
                {
                    nativeMap.Children.Remove(markerWindow);
                    markerWindowShown = false;
                }
            }
        }
Пример #18
0
 private async void Map_MapElementClick(MapControl sender, MapElementClickEventArgs args)
 {
     var clickedIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;
     var poi         = _routeIcons.FirstOrDefault(x => x.Value == clickedIcon).Key;
     var g           = new PointDataPage(poi);
     await g.ShowAsync();
 }
        private void OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var mapIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            if (mapIcon != null)
            {
                var customPin = GetCustomPin(mapIcon.Location.Position);

                if (customPin == null)
                {
                    throw new Exception("Custom pin not found");
                }

                _mapOverlay = new XamarinMapOverlay(customPin);

                var xamarinMapOverlays = _nativeMap.Children.Where(o => o is XamarinMapOverlay);

                // Remove shown XamarinMapOverlay
                foreach (var xamarinMapOverlay in xamarinMapOverlays)
                {
                    _nativeMap.Children.Remove(xamarinMapOverlay);
                }

                var snPosition = new BasicGeoposition {
                    Latitude = customPin.Pin.Position.Latitude, Longitude = customPin.Pin.Position.Longitude
                };
                var snPoint = new Geopoint(snPosition);

                _nativeMap.Children.Add(_mapOverlay);
                MapControl.SetLocation(_mapOverlay, snPoint);
                MapControl.SetNormalizedAnchorPoint(_mapOverlay, new Windows.Foundation.Point(0.5, 1.0));
            }
        }
Пример #20
0
        private void OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var mapicon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            if (mapicon != null)
            {
                if (!IsPetWindowVisible)
                {
                    if (PetWindow == null)
                    {
                        PetWindow = new MapWindow(Pet);
                    }
                    var position = new BasicGeoposition
                    {
                        Latitude  = Pet.Latitude,
                        Longitude = Pet.Longitude
                    };
                    var point = new Geopoint(position);

                    NativeMap.Children.Add(PetWindow);
                    MapControl.SetLocation(PetWindow, point);
                    MapControl.SetNormalizedAnchorPoint(PetWindow, new Windows.Foundation.Point(0.5, 1.0));

                    IsPetWindowVisible = true;
                }
                else
                {
                    NativeMap.Children.Remove(PetWindow);

                    IsPetWindowVisible = false;
                }
            }
        }
Пример #21
0
        private async void OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            try
            {
                foreach (Bestelling b in AppGlobal.Instance.BestellingController.LoadBestelling())
                {
                    if (b.fence != null)
                    {
                        if ((b.Position.Longitude - 0.004) <= args.Location.Position.Longitude && (b.Position.Longitude + 0.004) >= args.Location.Position.Longitude)
                        {
                            if ((b.Position.Latitude - 0.004) <= args.Location.Position.Latitude && (b.Position.Latitude + 0.004) >= args.Location.Position.Latitude)
                            {
                                AppGlobal.Instance._CurrentSession.CurrentBestelling = b;
                                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                              () =>
                                {
                                    PizzaPopup();
                                });

                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                return;
            }
        }
Пример #22
0
        private async void map_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            MapIcon icon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            foreach (var vet in vets)
            {
                if (vet.Location.Latitude == icon.Location.Position.Latitude && vet.Location.Longitude == icon.Location.Position.Longitude)
                {
                    BasicGeoposition bgp = new BasicGeoposition()
                    {
                        Latitude  = vet.Location.Latitude,
                        Longitude = vet.Location.Longitude
                    };

                    vetPanel.DataContext = vet;
                    vetPanel.Visibility  = Visibility.Visible;
                    if (vet.Color == "gray")
                    {
                        callButton.Visibility = Visibility.Collapsed;
                    }

                    var center = new Geopoint(bgp);
                    await map.TrySetViewAsync(center, 10, 0, 0, MapAnimationKind.Bow);

                    VetDetailsView.vet = vet;

                    break;
                }
            }
        }
 private void MapView_MapElementClick(MapControl sender, MapElementClickEventArgs args)
 {
     try {
         selectedCameras.Add(args.MapElements[0].Tag as Camera);
         OpenCameras();
     } catch {
     }
 }
Пример #24
0
        private void PageMap_MapElementClicked(MapControl sender, MapElementClickEventArgs args)
        {
            IEnumerable <Guid> tappedIds = args.MapElements
                                           .OfType <MapIcon>()
                                           .Select(x => (Guid)x.GetValue(MapElementExtensions.PoiIdProperty))
                                           .Where(x => x != default(Guid));

            ViewModel.MapElementTappedCommand.Execute(tappedIds);
        }
Пример #25
0
 private void OnMapElementClicked(MapControl sender, MapElementClickEventArgs args)
 {
     foreach (MapElement element in args.MapElements)
     {
         if (element.Tag is Canteen c)
         {
             VIEW_MODEL.MODEL.SelectedCanteen = c;
         }
     }
 }
Пример #26
0
        private void MyMap_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            MapIcon myClickedIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            if (myClickedIcon != null)
            {
                string Title = myClickedIcon.Title;
                myClickedIcon.Title = myClickedIcon.Tag.ToString();
                myClickedIcon.Tag   = Title;
            }
        }
Пример #27
0
        private void MainMap_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var mapIcons = args.MapElements.Where(me => me is MapIcon && BusStopIcons.Contains(me));

            BusStop[] stops = new BusStop[mapIcons.Count()];
            for (int i = 0; i < stops.Length; i++)
            {
                stops[i] = Stops[(MapIcon)mapIcons.ElementAt(i)];
            }
            OnStopsClicked(stops, args.Location.Position);
        }
Пример #28
0
        private async void UserMap_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var msf = new MessageDialog("roopansh Sir");
            await msf.ShowAsync();

            foreach (var item in UserMap.MapElements.ToList())
            {
                UserMap.MapElements.Remove(item);
                UserMap.MapElements.Clear();
            }
        }
Пример #29
0
        private void MapControl_MapElementClick(MapControl sender, MapElementClickEventArgs args) {

            if (args?.MapElements?.Count > 0) {
                var node = nodeElementMap.Get(args.MapElements.First());
                SelectedNodeChangedEvent e = new SelectedNodeChangedEvent() {
                    node = node,
                    sender = this,
                };
                BusProvider.DefaultInstance.Post(e);
            }

        }
Пример #30
0
        private void NewNativeMapOnMapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var nativeItem = args.MapElements.FirstOrDefault(e => e is MapPolyline) as MapPolyline;

            if (nativeItem != null)
            {
                var targetOuterItem = GetItems(Map)
                                      .FirstOrDefault(outerItem => ((MapPolyline)outerItem.NativeObject) == nativeItem && outerItem.IsClickable);

                targetOuterItem?.SendTap();
            }
        }
        private void MapControl1_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            MapIcon myClickedIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;

            foreach (House listing in App.searchParam.getSearchResults())
            {
                if (myClickedIcon.Location.Position.Latitude == listing._latitude && myClickedIcon.Location.Position.Longitude == listing._longitude)
                {
                    App.currentDetail = listing;
                    propertyDetails.Navigate(typeof(HouseProperties));
                }
            }
        }
    // -------------------- QUERYING THE MAP -----------------------

    private async void OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
    {
      var resultText = new StringBuilder();

      // Yay! Goodbye string.Format!
      resultText.AppendLine($"Position={args.Position.X},{args.Position.Y}");
      resultText.AppendLine($"Location={args.Location.Position.Latitude:F9},{args.Location.Position.Longitude:F9}");

      foreach (var mapObject in args.MapElements)
      {
        resultText.AppendLine("Found: " + mapObject.ReadData<PointList>().Name);
      }
      var dialog = new MessageDialog(resultText.ToString(),
        args.MapElements.Any() ? "Found the following objects" : "No data found");
      await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
        async () => await dialog.ShowAsync());
    }
Пример #33
0
 private void MainMap_MapElementClick(MapControl sender, MapElementClickEventArgs args)
 {
     foreach (var addin in AddIns)
     {
         addin.OnMapElementsClicked(args.MapElements.Intersect(addin.MapElementsShown), args.Location.ToLatLon(), args.Position);
     }
 }
Пример #34
0
        private async void ElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            string dir = null;
            double ArgsLat = 0;
            double ArgsLon = 0;

            foreach (var e in args.MapElements)
            {
                var icon = e as MapIcon;
                dir = icon.Title;
                ArgsLat = icon.Location.Position.Latitude;
                ArgsLon = icon.Location.Position.Longitude;

            }
            if (!dir.Equals("MiPosicion"))
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Elegir Lugar");

                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Aceptar") { Id = 1 });
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Cancelar") { Id = 0 });

                var result = await dialog.ShowAsync();

                if (result.Id.Equals(1))
                {
                    progressRing.IsActive = true;

                    StorageFile file = plan.ImagenPlan;
                    var bytes = await GetBtyeFromFile(file);

                    ParseFile parseFile = new ParseFile("defaultimg.jpg", bytes, "image/jpeg");

                    ParseObject parseObject = new ParseObject("Plan");


                    parseObject.Add("nombre", plan.NombrePlan);
                    parseObject.Add("descripcion", plan.DescripcionPlan);
                    parseObject.Add("fecha", plan.FechaPlan + " " + plan.HoraPlan);
                    parseObject.Add("id_user", ParseUser.CurrentUser);
                    parseObject.Add("imagen", parseFile);

                    ParseGeoPoint geoLugar = new ParseGeoPoint(ArgsLat, ArgsLon);
                    parseObject.Add("lugar", geoLugar);

                    parseObject.Add("direccion", dir);

                    if (crearLugar == 1)
                    {

                        ParseObject objectLugar = new ParseObject("Lugares");
                        objectLugar.Add("nombre", titulo_lugar);
                        objectLugar.Add("direccion", dir);
                        objectLugar.Add("ubicacion", geoLugar);
                        await objectLugar.SaveAsync();
                        crearLugar = -1;
                    }

                    try
                    {
                        await parseObject.SaveAsync();

                        progressRing.IsActive = false;
                        rootFrame = Window.Current.Content as Frame;
                        rootFrame.Navigate(typeof(MainPage));

                    }
                    catch
                    {
                        var dialog2 = new Windows.UI.Popups.MessageDialog("Error al crear el plan, intentalo de nuevo");
                        dialog2.Commands.Add(new Windows.UI.Popups.UICommand("Aceptar") { Id = 1 });
                        var result2 = await dialog2.ShowAsync();
                        progressRing.IsActive = false;
                    }


                }
            }

        }
Пример #35
0
        private async void elementClick(MapControl sender, MapElementClickEventArgs args)
        {
            if (indicador == -1)
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Indicaciones desde aqui");
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Aceptar") { Id = 1 });
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Cancelar") { Id = 0 });
                var result = await dialog.ShowAsync();

                if (result.Id.Equals(1))
                {
                    startLocation = new BasicGeoposition() { Latitude = args.Location.Position.Latitude, Longitude = args.Location.Position.Longitude };
                    indicador = 1;
                }
            }
            else
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Indicaciones hasta aqui");
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Aceptar") { Id = 1 });
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Cancelar") { Id = 0 });
                var result = await dialog.ShowAsync();

                if (result.Id.Equals(1))
                {
                    endLocation = new BasicGeoposition() { Latitude = args.Location.Position.Latitude, Longitude = args.Location.Position.Longitude };
                    MapRouteFinderResult routeResult = await MapRouteFinder.GetDrivingRouteAsync(new Geopoint(startLocation),
                                                        new Geopoint(endLocation),
                                                        MapRouteOptimization.Time,
                                                        MapRouteRestrictions.None);
                    if (routeResult.Status == MapRouteFinderStatus.Success)
                    {

                        viewOfRoute = new MapRouteView(routeResult.Route);
                        viewOfRoute.RouteColor = Colors.Yellow;
                        viewOfRoute.OutlineColor = Colors.Black;

                        map.Routes.Add(viewOfRoute);

                        await map.TrySetViewBoundsAsync(routeResult.Route.BoundingBox, null, MapAnimationKind.None);
                    }

                }
                indicador = -1;

            }

        }
        private async void maps_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var location = args.Location.Position;
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                //if (maps.ZoomLevel < 15)
                //{
                //    maps.StartContinuousZoom(2);
                //    maps.ZoomLevelChanged += (ss, ee) =>
                //    {
                //        if (maps.ZoomLevel >= 15)
                //        {
                //            maps.StopContinuousZoom();
                //        }
                //    };
                //    if (ElementClickEvent != null)
                //    {
                //        ElementClickEvent(sender, new MapElementClickItemEventArgs() { args = args, isMaxZoom = false });
                //    }
                //}
                //else
                //{
                //    if (ElementClickEvent != null)
                //    {
                //        ElementClickEvent(sender, new MapElementClickItemEventArgs() { args = args, isMaxZoom = true });
                //    }
                //} 
                ElementClickEvent(sender, new MapElementClickItemEventArgs() { args = args, isMaxZoom = true });

            });


        }
Пример #37
0
 private void MapElementClick(MapControl sender, MapElementClickEventArgs args)
 {
     try
     {
         MapIcon mapIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;
         if (mapIcon != null)
         {
             ItemViewModel itemViewModel = ViewModel.Items.FirstOrDefault(x => x.Title == mapIcon.Title);
             if (itemViewModel != null)
             {
                 var coordinates = itemViewModel.Content.Split('*');
                 ActionCommands.NavigateToUrl.Execute(string.Format("bingmaps:?collection=point.{0}_{1}_{2}&lvl=18", coordinates[0], coordinates[1], itemViewModel.Title));
             }
         }
     }
     catch (Exception)
     {
     }
 }
Пример #38
0
 private void MainMap_MapElementClick(MapControl sender, MapElementClickEventArgs args)
 {
     var mapIcons = args.MapElements.Where(me => me is MapIcon && BusStopIcons.Contains(me));
     BusStop[] stops = new BusStop[mapIcons.Count()];
     for (int i = 0; i < stops.Length; i++)
     {
         stops[i] = Stops[(MapIcon)mapIcons.ElementAt(i)];
     }
     OnStopsClicked(stops, args.Location.Position);
 }
Пример #39
0
        private async void editElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            string dir = null;
            double ArgsLat = 0;
            double ArgsLon = 0;

            if (btnEditSiguiente.Visibility == Visibility.Visible)
            {

                foreach (var e in args.MapElements)
                {
                    var icon = e as MapIcon;
                    dir = icon.Title;
                    ArgsLat = icon.Location.Position.Latitude;
                    ArgsLon = icon.Location.Position.Longitude;

                }

                if (!dir.Equals("MiPosicion"))
                {

                    if (gPoint.Latitude == ArgsLat && gPoint.Longitude == ArgsLon) // si el lugar seleccionado es el lugar del plan
                    {
                        var dialog = new Windows.UI.Popups.MessageDialog("Este es el lugar");

                        dialog.Commands.Add(new Windows.UI.Popups.UICommand("Aceptar") { Id = 1 });
                        //dialog.Commands.Add(new Windows.UI.Popups.UICommand("Cancelar") { Id = 0 });

                        var result = await dialog.ShowAsync();
                    }
                    else
                    {
                        var dialog = new Windows.UI.Popups.MessageDialog("Elegir Lugar");

                        dialog.Commands.Add(new Windows.UI.Popups.UICommand("Aceptar") { Id = 1 });
                        dialog.Commands.Add(new Windows.UI.Popups.UICommand("Cancelar") { Id = 0 });

                        var result = await dialog.ShowAsync();

                        if (result.Id.Equals(1))
                        {
                            gPoint.Latitude = ArgsLat;
                            gPoint.Longitude = ArgsLon;
                            NombreLugarTxt.Text = dir;
                            if (direccion == null)
                            {
                                nuevo_existente = 1; // lugar existente

                            }
                            else
                            {
                                nuevo_existente = 2; // nuevo lugar

                                direccion = null;
                            }

                        }
                    }
                }
            }
            

        }
        private void RouteMap_MapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            // Just ignore anything that isn't a stop marker.
            if (!args.MapElements.Any(me => me is MapIcon))
            {
                return;
            }

            if (SelectedRoute != null)
            {
                var stopId = SelectedRoute.Path.FirstOrDefault(s => AreLocationsTheSame(StopLookup[s], args.Location));
                if (stopId != default(int))
                {
                    var arrivalsTask = Task.Run(() => GetArrivalsAsync(stopId));
                    arrivalsTask.Wait();

                    var arrival = arrivalsTask.Result;
                    if (arrival != null)
                    {
                        ShowArrivalMenu(sender, StopLookup[stopId], arrival);
                    }
                }
            }
        }
 private async void OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
 {
     try
     {
         foreach (Bestelling b in AppGlobal.Instance.BestellingController.LoadBestelling())
             if (b.fence != null)
             {
                 if ((b.Position.Longitude - 0.004) <= args.Location.Position.Longitude && (b.Position.Longitude + 0.004) >= args.Location.Position.Longitude)
                 {
                     if ((b.Position.Latitude - 0.004) <= args.Location.Position.Latitude && (b.Position.Latitude + 0.004) >= args.Location.Position.Latitude)
                     {
                         AppGlobal.Instance._CurrentSession.CurrentBestelling = b;
                         await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                         () =>
                         {
                             PizzaPopup();
                         });
                         break;
                     }
                 }
             }
     }
     catch (Exception)
     {
         return;
     }
 }
        private void OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
        {
            var mapIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;
            if (mapIcon != null)
            {
                if (!xamarinOverlayShown)
                {
                    var customPin = GetCustomPin(mapIcon.Location.Position);
                    if (customPin == null)
                    {
                        throw new Exception("Custom pin not found");
                    }

                    if (customPin.Id == "Xamarin")
                    {
                        if (mapOverlay == null)
                        {
                            mapOverlay = new XamarinMapOverlay(customPin);
                        }

                        var snPosition = new BasicGeoposition { Latitude = customPin.Pin.Position.Latitude, Longitude = customPin.Pin.Position.Longitude };
                        var snPoint = new Geopoint(snPosition);

                        nativeMap.Children.Add(mapOverlay);
                        MapControl.SetLocation(mapOverlay, snPoint);
                        MapControl.SetNormalizedAnchorPoint(mapOverlay, new Windows.Foundation.Point(0.5, 1.0));
                        xamarinOverlayShown = true;
                    }
                }
                else
                {
                    nativeMap.Children.Remove(mapOverlay);
                    xamarinOverlayShown = false;
                }
            }
        }