Exemplo n.º 1
0
        public async void LoadClientes()
        {
            try
            {
                var clientes = await apiService.GetMyClient();

                Locations = new ObservableCollection <TKCustomMapPin>();
                LocationsSearch.Clear();
                ListLocation.Clear();
                clientes.Count();
                if (clientes != null && clientes.Count > 0)
                {
                    Point p = new Point(0.48, 0.96);
                    foreach (var cliente in clientes)
                    {
                        var Pincliente = new TKCustomMapPin
                        {
                            Image       = "pin.png",
                            Position    = new Xamarin.Forms.Maps.Position(cliente.Latitud, cliente.Longitud),
                            Anchor      = p,
                            Title       = "Razón Social: " + cliente.RazonSocial,
                            Subtitle    = "Dirección: " + cliente.Direccion,
                            ShowCallout = true,
                        };
                        var itemcliente = new ListRequest
                        {
                            Titulo    = "Razón Social: " + cliente.RazonSocial,
                            Subtitulo = cliente.Direccion + " " + cliente.Telefono,
                            idCliente = cliente.IdCliente,
                        };

                        Locations.Add(Pincliente);
                        ListLocation.Add(itemcliente);
                        listlocationAux.Add(itemcliente);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Exemplo n.º 2
0
 public async void SearchClient(string text)
 {
     IsSearch = false;
     LocationsSearch.Clear();
     locationsSearch.Clear();
     if (text == "" || text == null)
     {
         IsSearch = false;
     }
     else
     {
         var a = Locations.Where(p => p.Title.ToLower().Contains(text.ToLower()));
         if (a != null)
         {
             foreach (var item in a)
             {
                 LocationsSearch.Add(item);
                 //  await MoveTo(item.Position);
             }
             IsSearch = true;
         }
     }
 }