コード例 #1
0
 private void Map_PinClicked(object sender, PinClickedEventArgs e)
 {
     //e.Handled = true;
     //var uri = new Uri("http://maps.google.com/maps?daddr=" + e.Pin.Position.Latitude + "," + e.Pin.Position.Longitude);
     //Task t = Launcher.OpenAsync(uri);
     //t.Wait();
 }
コード例 #2
0
        async void OnPinClicked(object sender, PinClickedEventArgs e)
        {
            map.PropertyChanged -= OnMapChangeProperty;
            var pin = sender as PinWithEntity;

            pin.Label = "";
            var   d    = Task.Delay(700);
            var   recs = map.Pins.Where(p => pin.Position.Distance(p.Position) <= 90).Select(p => (p as PinWithEntity).Entity as Record).OrderBy(x => pin.Position.Distance(x.Point));
            var   len  = recs.Count();
            await d;
            var   position = pin.Position;

            map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude - 0.0015, position.Longitude),
                                                         Distance.FromMeters(150)));
            State = MainPageStatus.ShowRecord;
            var playerView = new RecordPlayer(recs);

            relBox.HeightRequest = gridMenu.Height + (MapPage.Height - gridMenu.Height) / 2;
            relBox.Children.Add(playerView
                                , Constraint.Constant(0),
                                Constraint.Constant(0),
                                Constraint.RelativeToParent((parent) => parent.Width),
                                Constraint.RelativeToView(gridMenu, (parent, menu) =>
            {
                return(parent.HeightRequest - menu.Height);
            })
                                );

            map.PropertyChanged += OnMapChangeProperty;
        }
コード例 #3
0
 public void PinClicked(object sender, PinClickedEventArgs args)
 {
     if (pinInfo.TranslationY > 0)
     {
         pinInfo.TranslateTo(0, pinInfo.TranslationY - moveDistance, 500);
     }
 }
コード例 #4
0
ファイル: PinPage.xaml.cs プロジェクト: joseluishl123/Cliente
 async void OnInfoWindowClickedAsync(object sender, PinClickedEventArgs e)
 {
     var    property = ((Pin)sender).BindingContext as Property;
     string pinName  = ((Pin)sender).Label;
     //await DisplayAlert("", property.Price , "Ok");
     //await Navigation.PushModalAsync(new DetailsPage(property));
 }
コード例 #5
0
 private void Pin_OnMarkerClicked(object sender, PinClickedEventArgs e)
 {
     if (BindingContext is MainViewModel model)
     {
         model.MarkerClickedCommand?.Execute((CustomPin)sender);
     }
 }
コード例 #6
0
        async void OnMarkerClickedAsync(object sender, PinClickedEventArgs e)
        {
            e.HideInfoWindow = true;
            string pinName = ((Pin)sender).Label;

            await DisplayAlert("Pin Clicked", $"{pinName} was clicked.", "Ok");
        }
コード例 #7
0
        private async void MapPinClicked(object sender, PinClickedEventArgs e)
        {
            var entry = markers[e.Pin];

            while (queue.Count > 0)
            {
                var item = queue.Dequeue();
                if (item != entry)
                {
                    item.Reset();
                }
            }

            queue.Enqueue(entry);

            if (entry.SecondClick)
            {
                var stop = entry.Stop;
                var dt   = findEarliestDeparture(stop);
                var res  = await Request.SendDepartureBoardRequestAsync(new StationInfoRequest(useStopNotStation ? stop.ID : stop.ParentStation.ID, dt, 5, !useStopNotStation));

                if (res != null)
                {
                    Device.BeginInvokeOnMainThread(async() => await Navigation.PushAsync(new DepartureBoardResultsPage(res, true, stop.ParentStation.Name), true));
                }
            }
        }
コード例 #8
0
 private async void Pin_MarkerClicked(object sender, PinClickedEventArgs e)
 {
     if (sender is Pin pin && pin.BindingContext is Stops stop)
     {
         await ShowScheduleForStop(stop);
     }
 }
コード例 #9
0
        private void OnPinClicked(object sender, PinClickedEventArgs e)
        {
            if (e.Pin != null)
            {
                if (e.NumOfTaps == 2)
                {
                    // Hide Pin when double click
                    //DisplayAlert($"Pin {e.Pin.Label}", $"Is at position {e.Pin.Position}", "Ok");
                    e.Pin.IsVisible = false;
                }
                if (e.NumOfTaps == 1)
                {
                    if (e.Pin.Callout.IsVisible)
                    {
                        e.Pin.HideCallout();
                    }
                    else
                    {
                        e.Pin.ShowCallout();
                    }
                }
            }

            e.Handled = true;
        }
コード例 #10
0
 private void Map_PinClicked(object sender, PinClickedEventArgs e)
 {
     Current?.CancelCommand.Execute(null);
     Current        = CreateLocVM(pins[e.Pin].ShallowCopy());
     slider.Maximum = Math.Max(map.VisibleRegion.Radius.Meters, Current.Radius);
     slider.Value   = Current.Radius;
     slider.Minimum = 1;
 }
コード例 #11
0
ファイル: PinPage.xaml.cs プロジェクト: joseluishl123/Ordenes
        async void OnInfoWindowClickedAsync(object sender, PinClickedEventArgs e)
        {
            var    property = ((Pin)sender).BindingContext as TiendaModelo;
            string pinName  = ((Pin)sender).Label;

            tiendas.SelectCategoryCommand.Execute(property);
            //await DisplayAlert("", property.Price , "Ok");
            //await Navigation.PushModalAsync(new DetailsPage(property));
        }
コード例 #12
0
        private async void AirsMap_PinClicked(object sender, PinClickedEventArgs e)
        {
            var ctrl = _context.IATADirectMapPinsList.Where(x => x.IATA.Equals(e.Pin.Label)).FirstOrDefault();

            if (ctrl != null)
            {
                await Navigation.PushAsync(new AirPortCostsPage(_context.SrcAirPort, ctrl));
            }
        }
コード例 #13
0
 private void CustomMapView_PinClicked(object sender, PinClickedEventArgs e)
 {
     e.Handled = true;
     if (e.Pin != _selectedPin)
     {
         SelectPin(e.Pin);
         SelectedPin = null;
     }
 }
コード例 #14
0
        private void OnPinClicked(object sender, PinClickedEventArgs e)
        {
            var vehicle = ViewModel.FindByPinTag((Guid)e.Pin.Tag);

            if (vehicle != null)
            {
                e.Pin.Label = vehicle.Label;
            }
            e.Handled = false;
        }
コード例 #15
0
        private async void Pin_OnInfoWindowClicked(object sender, PinClickedEventArgs e)
        {
            // find Business by Position
            Business business = GetBusinessFromPin(sender as Pin);

            if (business != null)
            {
                await Navigation.PushModalAsync(new BusinessPage(business));
            }
        }
コード例 #16
0
ファイル: MainPage.xaml.cs プロジェクト: ananastya1/MSP_HSE
 private async void Pin_MarkerClicked(object sender, PinClickedEventArgs e)
 {
     Pin buf = sender as Pin;
     ConnectionWithDataBase db = Search(buf);
     string     s          = $"https://archi.ru/projects/world/{db.index}";
     Obj        obj1       = new Obj(s, buf, db.image);
     DetailPage detailPage = new DetailPage(obj1);
     //detailPage.BindingContext = obj1;
     await Navigation.PushModalAsync(detailPage);
 }
コード例 #17
0
        private void Map_PinClicked(object sender, PinClickedEventArgs e)
        {
            var map = sender as Map;
            var currentCameraPosition = new CameraPosition(e.Pin.Position, map.CameraPosition.Zoom, 0, 0);

            map.MoveCamera(CameraUpdateFactory.NewCameraPosition(currentCameraPosition));

            Xamarin.Essentials.Preferences.Set("LastCameraPosition", JsonConvert.SerializeObject(new Utilities.ExtensionCameraPosition(currentCameraPosition)));
            (BindingContext as ViewModels.MainPageViewModel).MapCameraUpdate = CameraUpdateFactory.NewCameraPosition(currentCameraPosition);
        }
コード例 #18
0
 private void Map_PinClicked(object sender, PinClickedEventArgs e)
 {
     if (e.Pin.Tag == "current_location")
     {
         MapViewModel.SelectedPin    = null;
         MapViewModel.ShowInfoWindow = false;
         return;
     }
     MapViewModel.SelectedPin    = MapViewModel.Airports.FirstOrDefault(c => c.codeIataAirport == (string)e.Pin.Tag);
     MapViewModel.ShowInfoWindow = true;
 }
コード例 #19
0
 private void LocationsMap_OnPinClicked(object sender, PinClickedEventArgs e)
 {
     if (e.Pin != null)
     {
         Location clickedLocation = _viewModel.LocationItems.SingleOrDefault(l => l.Name == (e.Pin).Label);
         if (clickedLocation != null)
         {
             LocationCollectionView.ScrollTo(clickedLocation, position: ScrollToPosition.Start);
         }
     }
 }
コード例 #20
0
        private void Mapa_PinClicked(object sender, PinClickedEventArgs e)
        {
            var pines = ((Xamarin.Forms.GoogleMaps.Map)sender).Pins;

            for (int i = 0; i < pines.Count; i++)
            {
                if (e.Pin.Equals(pines[i]))
                {
                    ViewModel.pinClicked.Execute(i);
                    return;
                }
            }
        }
コード例 #21
0
        // Do NOT mark async method.
        // Because Xamarin.Forms.GoogleMaps wait synchronously for this callback returns.
        void Map_PinClicked(object sender, PinClickedEventArgs e)
        {
            e.Handled = switchHandlePinClicked.IsToggled;

            // If you set e.Handled = true,
            // then Pin selection doesn't work automatically.
            // All pin selection operations are delegated to you.
            // Sample codes are below.
            //if (switchHandlePinClicked.IsToggled)
            //{
            //    map.SelectedPin = e.Pin;
            //    map.AnimateCamera(CameraUpdateFactory.NewPosition(e.Pin.Position));
            //}
        }
コード例 #22
0
        private async void Pin_MarkerClicked(object sender, PinClickedEventArgs e)
        {
            var pin = sender as Pin;

            if (pin.Type == PinType.SavedPin)
            {
                var nDriverID = int.Parse(pin.Label);
                if (DriverID == nDriverID)
                {
                    DriverID = 0;
                    polylineDriver.Geopath.Clear();
                    chosenDriver.Text = "";
                }
                else
                {
                    DriverID          = nDriverID;
                    driver            = drivers.Where(d => d.driverID == DriverID).First();
                    chosenDriver.Text = $"{driver.longitude} {driver.latitude}";
                }
            }
            else if (pin.Type == PinType.SearchResult)
            {
                var nOrderID = int.Parse(pin.Label);
                if (OrderID == nOrderID)
                {
                    OrderID = 0;
                    polylineOrder.Geopath.Clear();
                    polylineDriver.Geopath.Clear();
                    chosenUser.Text = "";
                    UserPathLength  = 0;
                    CalculatePrice(null, null);
                }
                else
                {
                    OrderID         = nOrderID;
                    order           = orders.Where(o => o.orderID == OrderID).First();
                    chosenUser.Text = $"{order.longitudeFrom} {order.latitudeFrom} - {order.longitudeTo} {order.latitudeTo} ";

                    UserPathLength = await DrawPolyline(polylineOrder, new SimpleWaypoint(order.latitudeFrom, order.longitudeFrom), new SimpleWaypoint(order.latitudeTo, order.longitudeTo));

                    CalculatePrice(null, null);
                }
            }
            if (OrderID == 0 || DriverID == 0)
            {
                return;
            }
            DrawPolyline(polylineDriver, new SimpleWaypoint(driver.latitude.GetValueOrDefault(), driver.longitude.GetValueOrDefault()), new SimpleWaypoint(order.latitudeFrom, order.longitudeFrom));
        }
コード例 #23
0
        private async void Mapa_PinClicked(object sender, PinClickedEventArgs e)
        {
            Imovel a = ((Imovel)e.Pin.BindingContext);

            //   Imovel imovel = viewModel.LstImoveis.Where(p => p.id == a.id).FirstOrDefault();
            if (a != null)
            {
                caroussel.SelectedItem = a;// this.Inicio.viewModel.LstImoveis.IndexOf(a);
                Mapa.MoveToRegion(MapSpan.FromCenterAndRadius(
                                      new Position(a.localizacao.Latitude, a.localizacao.Longitude),
                                      Distance.FromMiles(0.5)));
            }

            //e.Handled = true;
        }
コード例 #24
0
        private async void MapView_PinClicked(object sender, PinClickedEventArgs e)
        {
            if (selectedPin == e.Pin)
            {
                switch (await DisplayActionSheet("Select Action", "Cancel", null, new string[] { "Get Directions" }))
                {
                case "Get Directions":
                {
                    var merchant = e.Pin.Tag as Models.Merchant;
                    using (DialogHelpers.ShowProgress())
                    {
                        switch (Device.RuntimePlatform)
                        {
                        case Device.Android:
                            Device.OpenUri(new Uri($"google.navigation:q={merchant.LocationLat},{merchant.LocationLng}"));
                            break;

                        case Device.iOS:
                        {
                            if (Plugin.Geolocator.CrossGeolocator.Current.IsGeolocationAvailable)
                            {
                                UserDialogs.Instance.ShowLoading("Processing...");

                                try
                                {
                                    var location = await Plugin.Geolocator.CrossGeolocator.Current.GetPositionAsync();

                                    Device.OpenUri(new Uri($"http://maps.apple.com/?saddr={location.Latitude},{location.Longitude}&daddr={merchant.LocationLat},{merchant.LocationLng}"));
                                }
                                catch
                                {
                                    await DisplayAlert("Directions", "Failed getting current location", "Ok");
                                }
                                finally{
                                    UserDialogs.Instance.HideLoading();
                                }
                            }
                        }
                        break;
                        }
                    }
                }
                break;
                }
            }

            selectedPin = e.Pin;
        }
コード例 #25
0
        void Map_PinClicked(object sender, PinClickedEventArgs e)
        {
            DisplayAlert("Pin Clicked", $"{e.Pin.Label} Clicked.", "Close");

            e.Handled = switchHandlePinClicked.IsToggled;

            // If you set e.Handled = true,
            // then Pin selection doesn't work automatically.
            // All pin selection operations are delegated to you.
            // Sample codes are below.
            //if (switchHandlePinClicked.IsToggled)
            //{
            //    map.SelectedPin = e.Pin;
            //    map.MoveToRegion(MapSpan.FromCenterAndRadius(e.Pin.Position, Distance.FromMeters(500)), true);
            //}
        }
コード例 #26
0
        private async Task PinClicked(PinClickedEventArgs args)
        {
            var hive = new Hive()
            {
                HiveName     = args.Pin.Label,
                HiveLocation = new Location()
                {
                    Latitude  = args.Pin.Position.Latitude,
                    Longitude = args.Pin.Position.Longitude
                }
            };

            _dialogService.ShowDialog("DeleteHiveDialog", new DialogParameters()
            {
                { "message", hive }
            }, OnDialogClosed);
        }
コード例 #27
0
ファイル: MapPage.xaml.cs プロジェクト: SitPark/CitPark
        private async void SpotsMap_PinClicked(object sender, PinClickedEventArgs e)
        {
            string ParkName = e.Pin.Label;

            // Find the park with the provided name.
            ParkingSpotPreview parkingSpotPreview = StoredData.ParkingSpotPreviews.FirstOrDefault(park => park.Name == ParkName);

            if (parkingSpotPreview == null)
            {
                CrossToastPopUp.Current.ShowToastError("Parking spot could not be found! Try again later");
                return;
            }

            // Get park details.
            parkingSpotPreview.Details = new ParkingSpotDetails();

            await Navigation.PushModalAsync(new ParkDetailsPage(parkingSpotPreview));
        }
コード例 #28
0
ファイル: MapPage.xaml.cs プロジェクト: Vaibhav-Khanna/NGC
        void Map_PinClicked(object sender, PinClickedEventArgs e)
        {
            if (e.Pin.Type == PinType.Generic)
            {
                ShowPopup();

                context.SelectedContact = e?.Pin?.BindingContext as Contact;

                if (context.SelectedContact != null)
                {
                    bt.BackgroundColor = GetCheckinColor(context.SelectedContact);
                }
            }
            else
            {
                HidePopUp();
            }
        }
コード例 #29
0
        // Map Clicked event handler
        private async void map_PinClicked(object sender, PinClickedEventArgs e)
        {
            try
            {
                if (LoginPageView.token == null)
                {
                }
                else
                {
                    await Task.Delay(100);

                    await Navigation.PushModalAsync(new ResolveFireInfoView(e.Pin.Label, e.Pin.Address, e.Pin.Tag.ToString()), false);
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
        }
コード例 #30
0
        private async void LocPin_InfoWindowClicked(object sender, PinClickedEventArgs e)
        {
            Pin pin = sender as Pin;

            List <MapData> model = nvm.Locations;

            foreach (var i in model)
            {
                if (i.CountryData.Country == pin.Label)
                {
                    string content = JsonConvert.SerializeObject(i.CountryData);

                    Preferences.Set("AllData", content);
                    //await App.Current.MainPage.Navigation.PushAsync(new MapDataPage());

                    await Shell.Current.GoToAsync(nameof(MapDataPage));
                }
            }
        }