/// <summary> /// Hàm xử lý khi có thay đổi về Text /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MySearch_TextChanged(object sender, TextChangedEventArgs e) { var search = sender as SearchBar; if (search != null && search.Text != null && !search.Text.Equals("")) { lvAutoComplete.IsVisible = true; Task.Run(async() => { var list = await Helpers.Helper.Database.SearchArea(search.Text); Device.BeginInvokeOnMainThread(() => { if (list.Count > 0) { ListAutoComplete.Clear(); ListAutoComplete.AddRange(list); } }); }); } else { ListAutoComplete.Clear(); } }
/// <summary> /// search từng /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Search_TextChanged(object sender, TextChangedEventArgs e) { var search = sender as SearchBar; //nếu người dùng tìm kiếm theo tên //if (lvAutoComplete.IsVisible) //{ // lvAutoComplete.IsVisible = false; // lvAutoComplete.BackgroundColor = Color.Transparent; //} //if (search != null && !Search.Text.Equals("")) //{ // model.SearchClub(search.Text, 0); //} //Nếu người dùng tìm kiếm theo địa điểm if (search != null && search.Text != null && !search.Text.Equals("")) { if (!lvAutoComplete.IsVisible) { lvAutoComplete.IsVisible = true; lvAutoComplete.BackgroundColor = Color.White; } Task.Run(async() => { var list = await Helpers.Helper.Database.SearchArea(search.Text); Device.BeginInvokeOnMainThread(() => { if (list.Count > 0) { ListAutoComplete.Clear(); ListAutoComplete.AddRange(list); } }); }); } else { if (lvAutoComplete.IsVisible) { lvAutoComplete.IsVisible = false; lvAutoComplete.BackgroundColor = Color.Transparent; } ListAutoComplete.Clear(); } }
public void CarregarMenu() { var collection = _service.ItensMenu(); ItensMenu.AddRange(collection); }