Exemple #1
0
        private async Task <List <CustomPin> > ShowPinsAsync()
        {
            CustomPin pin = new CustomPin
            {
                Type     = PinType.Place,
                Position = new Position(-0, 0),

                Label   = " ",
                Address = " ",
                Name    = " ",
                StyleId = "",
                Url     = ""
            };

            var pins = new List <CustomPin> {
                pin
            };
            CablesPageViewModel cablesViewModel = CablesPageViewModel.GetInstance();

            foreach (CableItemViewModel cable in cablesViewModel.Cables.ToList())
            {
                if (!string.IsNullOrEmpty(cable.GRXX) && !string.IsNullOrEmpty(cable.GRYY))
                {
                    if (cable.GRXX.Length > 5 && cable.GRYY.Length > 5)
                    {
                        Position position = new Position(Convert.ToDouble(cable.GRXX), Convert.ToDouble(cable.GRYY));
                        var      HayCita  = "";
                        if (cable.FechaCita == null)
                        {
                            HayCita = "SinCita";
                        }
                        else
                        {
                            if (cable.FechaCita.Value.Date == DateTime.Today)
                            {
                                HayCita = "ConCitaHoy";
                            }
                            else
                            {
                                HayCita = "ConCitaOtroDia";
                            }
                        }

                        MyMap.Pins.Add(new CustomPin
                        {
                            Label    = cable.NOMBRE + " Cita: " + cable.FechaCita.ToString(),
                            Address  = cable.DOMICILIO,
                            Position = position,
                            Type     = PinType.Place,
                            StyleId  = HayCita,
                            ClassId  = "Cable",
                        });
                    }
                }
            }
            return(pins);
        }
Exemple #2
0
        void OnInfoWindowClick(object sender, GoogleMap.InfoWindowClickEventArgs e)
        {
            //var customPin = GetCustomPin(e.Marker);
            //if (customPin == null)
            //{
            //    throw new Exception("Custom pin not found");
            //}

            //if (!string.IsNullOrWhiteSpace(customPin.Url))
            //{
            //    var url = Android.Net.Uri.Parse(customPin.Url);
            //    var intent = new Intent(Intent.ActionView, url);
            //    intent.AddFlags(ActivityFlags.NewTask);
            //    Android.App.Application.Context.StartActivity(intent);
            //}


            int lugar = e.Marker.Title.IndexOf(" Cita: ");

            var txtBuscar = e.Marker.Title.Substring(0, lugar);

            if (opc == 1)
            {
                CablesPageViewModel.GetInstance().Filter = txtBuscar;
                CablesMapPageViewModel.GetInstance().CerrarMapa();
            }

            if (opc == 2)
            {
                RemotesPageViewModel.GetInstance().Filter = txtBuscar;
                RemotesMapPageViewModel.GetInstance().CerrarMapa();
            }

            if (opc == 3)
            {
                TasasPageViewModel.GetInstance().Filter = txtBuscar;
                TasasMapPageViewModel.GetInstance().CerrarMapa();
            }
        }
        private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
        {
            var cablesViewModel = CablesPageViewModel.GetInstance();

            cablesViewModel.RefreshList();
        }