public ActionResult LoadMoreArticles(int pageSize, int currentPageIndex, string category, string searchText) { var searchPage = new SearchPageViewModel(); SearchingCriteria(currentPageIndex + 1, pageSize, category, searchText, searchPage); return(PartialView("ResultListItems", searchPage)); }
protected virtual SearchPageViewModel GetSearchPage(SearchResult <SearchableBase> searchResult) { var searchResultViewModels = searchResult.Documents.Select(d => { var resultItem = d.Map <SearchResultViewModel>(); resultItem.Type = _localizationService.Translate($"{SearchTranslationPrefix}{_searchableTypeProvider[d.Type].ToString()}"); return(resultItem); }).ToList(); var filterItems = GetSearchableTypes().GroupJoin( searchResult.TypeFacets, type => type.ToInt(), facet => int.Parse(facet.Name), (type, facets) => { var facet = facets.FirstOrDefault(); return(new SearchFilterItemViewModel { Id = type.ToInt(), Name = GetLabelWithCount($"{SearchTranslationPrefix}{type.ToString()}", facet != null ? (int)facet.Count : default(int)) }); }); var result = new SearchPageViewModel() { Results = searchResultViewModels, ResultsCount = (int)searchResult.TotalHits, FilterItems = filterItems, AllTypesPlaceholder = GetLabelWithCount("Search.Filter.All.lbl", (int)searchResult.TotalHits), BlockScrolling = searchResult.TotalHits <= searchResultViewModels.Count }; return(result); }
public async Task <ActionResult> SearchRefList(string q, int pageIndex = 1) { if (string.IsNullOrWhiteSpace(q)) { var vm = new SearchPageViewModel() { TextSearch = q, PageIndex = pageIndex, PageCount = 1, RefLists = EmptyRefListViewModels, }; return(JsonNet(vm, JsonRequestBehavior.AllowGet)); } else { var pageSize = 20; var start = (pageIndex - 1) * pageSize; var result = await _refListHandler.SearchRefListsAsync(q, start, 20); var vm = new SearchPageViewModel() { TextSearch = q, PageIndex = pageIndex, PageCount = IndexUtil.GetPageCount(result.WholeCount, pageSize), RefLists = Mapper.Map <ICollection <RefListViewModel> >(result.RefLists), }; return(JsonNet(vm, JsonRequestBehavior.AllowGet)); } }
public async Task <IActionResult> Search(string keywords, int page = 1) { SearchPageViewModel vm = new SearchPageViewModel { Keywords = keywords, TopicList = new TopicListModel { Data = new List <TopicModel>() } }; int pageSize = 10; ViewBag.Title = $"搜索结果:{keywords}"; if (!string.IsNullOrWhiteSpace(keywords)) { var topicList = await TopicService.QueryByKeywords(page, pageSize, keywords); vm.TopicList = new TopicListModel { Data = topicList.Data, PageIndex = page, PageSize = pageSize, Total = topicList.Total }; } return(this.View(vm)); }
public SearchPageViewCS(SearchPageViewModel searchPageViewModel) { this.searchPageListViewModel = searchPageViewModel.SearchPageEntityViewModel; AddContent(); Visual = VisualMarker.Material; BindingContext = this.searchPageListViewModel; }
public MainViewModel(LoginPageViewModel loginPageViewModel, PlaylistsPageViewModel playlistsPageViewModel, SearchPageViewModel searchPageViewModel) { _playlistsPageViewModel = playlistsPageViewModel; _searchPageViewModel = searchPageViewModel; CurrentPage = loginPageViewModel; MessengerInstance.Register <object>(this, MessageType.LoginSuccessful, LoginSuccessful); MenuItems = new ObservableCollection <MenuItemViewModel> { new MenuItemViewModel("File") { MenuItems = new ObservableCollection <MenuItemViewModel> { new MenuItemViewModel("Exit", new RelayCommand(Exit)) } }, new MenuItemViewModel("View", new RelayCommand <MenuItemViewModel>(SwitchViewFromMenuItem)) { MenuItems = new ObservableCollection <MenuItemViewModel> { new MenuItemViewModel("Search", new RelayCommand <MenuItemViewModel>(SwitchViewFromMenuItem)) { IsChecked = true }, new MenuItemViewModel("Playlists", new RelayCommand <MenuItemViewModel>(SwitchViewFromMenuItem)), } } }; }
public SearchPageView(SearchPageViewModel searchPageViewModel) { this.searchPageListViewModel = searchPageViewModel.SearchPageEntityViewModel; InitializeComponent(); AddToolBarItems(); Title = this.searchPageListViewModel.FormSettings.Title; this.BindingContext = this.searchPageListViewModel; void AddToolBarItems() { foreach (var button in this.searchPageListViewModel.Buttons) { this.ToolbarItems.Add(BuildToolbarItem(button)); } } ToolbarItem BuildToolbarItem(CommandButtonDescriptor button) => new ToolbarItem { AutomationId = button.ShortString, //Text = button.LongString, IconImageSource = new FontImageSource { FontFamily = EditFormViewHelpers.GetFontAwesomeFontFamily(), Glyph = FontAwesomeIcons.Solid[button.ButtonIcon], Size = 20 }, Order = ToolbarItemOrder.Primary, Priority = 0, CommandParameter = button } .AddBinding(MenuItem.CommandProperty, new Binding(button.Command)) .SetAutomationPropertiesName(button.ShortString); }
public ActionResult Index(int?id) { SearchPageViewModel model = new SearchPageViewModel { Categories = context.Categories, categoryID = id }; string subcnames = ""; if (id == null) { foreach (var item in context.SubCategories) { subcnames += item.SubCategoryName + " "; } } else { foreach (var item in context.SubCategories.Where(sb => sb.CategoryID == id)) { subcnames += item.SubCategoryName + " "; } } model.Subcategories = subcnames; return(View(model)); }
public ContainerPageViewModel() { UrlPathSegment = "Tabbed page"; ColorViewModel = new ColorViewModel(); RestViewModel = new RestPageViewModel(); SearchPageViewModel = new SearchPageViewModel(); }
public ActionResult Search(string search) { var snippets = new HashSet <Snippet>(); if (search != string.Empty) { var snippetsByTitle = this.Data.Snippets.All() .Where(s => s.Title.Contains(search)); IEnumerable <Snippet> snippetsByLabels = this.Data.Labels.All() .Where(l => l.Text.Contains(search)) .SelectMany(l => l.Snippets); foreach (var snippet in snippetsByTitle) { snippets.Add(snippet); } foreach (var snippet in snippetsByLabels) { snippets.Add(snippet); } } var model = new SearchPageViewModel() { Snippets = snippets.AsQueryable().Select(SnippetViewModel.Create) }; return(View(model)); }
public async Task <ActionResult> Search(string q = "") { var vm = new SearchPageViewModel() { TextSearch = q, PageIndex = 1, }; if (!string.IsNullOrWhiteSpace(q)) { if (q.StartsWith("http://") || q.StartsWith("https://")) { var url = Uri.EscapeUriString(q); return(RedirectToAction("FindByBookmarklet", new { url = url, title = q, })); } else { var result = await _refListHandler.SearchRefListsAsync(q, 0, 20); vm.PageCount = IndexUtil.GetPageCount(result.WholeCount, 20); vm.RefLists = Mapper.Map <ICollection <RefListViewModel> >(result.RefLists); } } else { vm.PageCount = 1; vm.RefLists = EmptyRefListViewModels; } return(View(vm)); }
public SearchPageView() { Xamarin.Forms.NavigationPage.SetHasNavigationBar(this, false); InitializeComponent(); BindingContext = new SearchPageViewModel(this); On <iOS>().SetUseSafeArea(true); }
public SearchPage(Subject subject) { Subject = subject; ViewModel = new SearchPageViewModel(subject); BindingContext = ViewModel; InitializeComponent(); }
private async Task OnOpenAsync(SearchPageViewModel owner, NavigationMetaData metaData) { owner.IsBusy = true; var view = await NavigationManager.MaterialiseViewModelAsync(metaData); if (view is NavBarItemViewModel navBarItem && navBarItem.OpenCommand.CanExecute(default))
private static SearchPageViewModel GetDemoSearchResult() { var ret = new SearchPageViewModel { CurrentPage = 1, EnableFacets = false, PageHasProdResultsPart = false, PageSize = 20, TotalResults = 50, KeyWords = "Lorem Ipsum", Title = "Lorem Ipsum", Products = new ProductsWithRanking() }; var product = new ProductWithRanking[20]; for (var i = 0; i < 20; i++) { product[i] = NewProduct(); } ret.Products.Product = product; return(ret); }
static SharedVM() { MainVM = new MainViewModel(); HomeVM = new HomePageViewModel(); RecipeVM = new AddRecipePageViewModel(); SearchVM = new SearchPageViewModel(); }
public SearchPage() { InitializeComponent(); BindingContext = vm = new SearchPageViewModel(); vm.AccessTracklistEventHandler += (object s, object r) => { if (vm.accessTracklistNumber == 0) { Application.Current.MainPage.DisplayAlert("Error", "Tracklist not found.", "OK"); } else { Navigation.PushAsync(new TracklistPage(vm.accessTracklistNumber)); } }; vm.AccessAlbumListEventHandler += (object s, object r) => { if (vm.accessAlbumListNumber == 0) { Application.Current.MainPage.DisplayAlert("Error", "Tracklist not found.", "OK"); } else { Navigation.PushAsync(new AlbumListPage(vm.accessAlbumListNumber)); } }; }
protected virtual SearchPageViewModel GetNextPage(CreateSearchPaginationParam <TParam> param) { var searchCriteria = param.SearchParameters.Criteria; var nextPage = new SearchPageViewModel { DisplayName = LocalizationProvider .GetLocalizedString(new GetLocalizedParam { Category = "List-Search", Key = "B_Next", CultureInfo = searchCriteria.CultureInfo }) }; if (param.CurrentPageIndex < param.TotalNumberOfPages) { searchCriteria.Page = param.CurrentPageIndex + 1; nextPage.Url = GenerateUrl(param); } else { nextPage.IsCurrentPage = true; } return(nextPage); }
protected virtual SearchPageViewModel GetPreviousPage(CreateSearchPaginationParam <TParam> param) { var searchCriteria = param.SearchParameters.Criteria; var previousPage = new SearchPageViewModel { DisplayName = LocalizationProvider .GetLocalizedString(new GetLocalizedParam { Category = "List-Search", Key = "B_Previous", CultureInfo = searchCriteria.CultureInfo }) }; if (param.CurrentPageIndex > 1) { searchCriteria.Page = param.CurrentPageIndex - 1; previousPage.Url = GenerateUrl(param); } else { previousPage.IsCurrentPage = true; } return(previousPage); }
protected override void LoadState(object parameter, Dictionary <string, object> pageState) { base.LoadState(parameter, pageState); ConnectedAnimation searchAniamtion = ConnectedAnimationService.GetForCurrentView().GetAnimation("Search"); if (searchAniamtion != null) { searchAniamtion.TryStart(Search); } if (parameter != null) { if (parameter is string query) { Search.Text = query; ViewModel = new SearchPageViewModel(); ViewModel.SearchTerm = query; ViewModel.SearchClick(); } else if (parameter is SearchPageViewModel) { ViewModel = parameter as SearchPageViewModel; } } }
public SearchPage() { InitializeComponent(); vm = new SearchPageViewModel(); BindingContext = vm; searchHandler = new NewsCategorySearchHandler(); searchHandler.SearchQueryEvent += (obj, input) => { if (!string.IsNullOrWhiteSpace(input)) { try { // filter down the binding context var filteredCategories = new AllNewsCategories() .Where(cat => cat.DisplayName.Contains(input.ToUpper())).ToList(); vm.NewsCategories.Clear(); vm.NewsCategories = new ObservableRangeCollection <NewsCategory>(filteredCategories); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine($"***** {ex} *****"); } } else { vm.NewsCategories = new ObservableRangeCollection <NewsCategory>(new AllNewsCategories()); } }; Shell.SetSearchHandler(this, searchHandler); }
public SearchPage() { SearchPageViewModel vm = new SearchPageViewModel(); this.BindingContext = vm; InitializeComponent(); this.searchControl.FilterChangeCallback = vm.FilterChanged; }
public ActionResult Search(string keyword) { var vm = new SearchPageViewModel(); vm.SearchValue = keyword; vm.Results = (new MugController()).Search(keyword); return(Result(vm)); }
public SearchPage() { InitializeComponent(); _vm = App.ServiceProvider.GetService <SearchPageViewModel>(); DataContext = _vm; }
/// <summary> /// ctor(). /// </summary> public SearchPage() { InitializeComponent(); BindingContext = _viewModel = new SearchPageViewModel(); _viewModel.Spot = spot_ContentView; }
public SearchPage() { BindingContext = _viewModel = new SearchPageViewModel(); InitializeComponent(); CityEntry.Completed += Search_OnCompleted; ClearHistoryButton.Clicked += ClearHistoryButton_OnClickedAsync; }
public static SearchPageViewModel Create(SearchPage currentPage, string query, int page) { var model= new SearchPageViewModel(currentPage); PageViewModelBuilder.SetBaseProperties(model); model.SearchResult = new PagedList<SearchHit>(GetSearchResult(currentPage, query, page), page, PageSize); model.Query = query; model.Page = page; return model; }
public SearchTemplateViewModel(Template template, INavigation navigation, SearchPageViewModel searchPage) { Template = template; Navigation = navigation; NavigateToTemplatePackCommand = new Command(() => ExecuteNavigateToTemplatePack()); SearchAuthor = new Command(ExecuteSearchAuthor); SearchPage = searchPage; }
private void RegisterViewModels() { SearchPageViewModel.Register(_searchPage); PrivacyModeViewModel.Register(_privacyMode); AddWalletPageViewModel.Register(_addWalletPage); SettingsPageViewModel.Register(_settingsPage); GeneralSettingsTabViewModel.RegisterLazy( () => { _settingsPage.SelectedTab = 0; return(_settingsPage); }); PrivacySettingsTabViewModel.RegisterLazy( () => { _settingsPage.SelectedTab = 1; return(_settingsPage); }); NetworkSettingsTabViewModel.RegisterLazy( () => { _settingsPage.SelectedTab = 2; return(_settingsPage); }); BitcoinTabSettingsViewModel.RegisterLazy( () => { _settingsPage.SelectedTab = 3; return(_settingsPage); }); AboutViewModel.RegisterLazy(() => new AboutViewModel()); BroadcastTransactionViewModel.RegisterAsyncLazy( async() => { var dialogResult = await DialogScreen.NavigateDialog(new LoadTransactionViewModel(_global.Network)); if (dialogResult.Result is { }) { while (_global.TransactionBroadcaster is null) { await Task.Delay(100); } return(new BroadcastTransactionViewModel( _global.BitcoinStore, _global.Network, _global.TransactionBroadcaster, dialogResult.Result)); } return(null); });
public ActionResult Index(SearchPage currentPage) { var model = new SearchPageViewModel { CurrentPage = currentPage, }; return(View(model)); }
// GET: /Search/ public ActionResult Index(string text, string genre) { Neo4jDataProvider dbNeo4j = new Neo4jDataProvider(); RedisDataProvider dbRedis = new RedisDataProvider(); ViewBag.showNav = true; SearchPageViewModel pageModel = new SearchPageViewModel(); //Is loged if (Session["user"] != null && Session["user"].GetType() == (typeof(ViewUser))) { pageModel.user = (ViewUser)(Session["user"]); dbRedis.AddSearchPhraseFromUser(pageModel.user.name, text); } List <string> redisResults = dbRedis.AutoComplete(pageModel.user != null ? pageModel.user.name : null, text, false); #region NavBarData if (genre == "All" || genre == "") { pageModel.genre = null; } else { pageModel.genre = genre; } //Getting artists pageModel.artists = dbNeo4j.ArtistRead(pageModel.genre); for (char c = 'A'; c <= 'Z'; c++) { if (pageModel.artists.ContainsKey(c.ToString())) { List <ViewArtist> tmp = pageModel.artists[c.ToString()]; pageModel.artists[c.ToString()] = tmp.OrderBy(x => x.name).ToList(); } } //Getting genres pageModel.genres = dbNeo4j.GenreRead(); pageModel.genres.Sort(); #endregion //Getting artist songs pageModel.matched = dbNeo4j.SearchResults(redisResults); pageModel.matched = pageModel.matched.OrderBy(x => x.artist + " - " + x.name).ToList(); pageModel.text = text; return(View(pageModel)); }