private void Search() { String rarity = null; String category = null; String subCategory = null; if (SelectedCategory != null) { category = SelectedCategory.Value.Key; if (category == "*") category = null; } if (SelectedSubCategory != null) { subCategory = SelectedSubCategory.Key; if (subCategory == "*") subCategory = null; } if (SelectedRarity != null) { rarity = SelectedRarity.Key; if (rarity == "*") rarity = null; } SearchFilters f = new SearchFilters() { QueryString = SearchString, TypeId = category, SubTypeId = subCategory, Rarity = rarity, LevelMin = MinLevel.ToString(), LevelMax = MaxLevel.ToString(), }; _hotItemController.Search(0, f); }
public void Search(int page, SearchFilters filters) { if (SearchFinished != null) { this.CurrentSearchFilters = filters; TaskFactory f = new TaskFactory(); var t = f.StartNew(() => { int count = HotItemController.CurrentApi.ItemsPerPage; int offset = (page) * HotItemController.CurrentApi.ItemsPerPage; ScrapeHelper searchScraper = new ScrapeHelper(Config.SessionKey); searchScraper.Finished += new EventHandler<Crawler.Event.ScrapeFinishedEventArgs>(searchScraper_Finished); string sortingMode = filters.SortingMode.ToString(); if (filters.SortingMode == SortingMode.none) { sortingMode = null; } IsSearchInProgress = true; String uri = HotItemController.CurrentApi.UriSearch( filters.QueryString, offset, count, filters.TypeId, filters.SubTypeId, filters.Rarity, filters.LevelMin, filters.LevelMax, sortingMode, filters.DescendingSorting); //h.UseSearchApi().Add("text", query).Add("offset", offset.ToString()).Add("count", count.ToString()).Generate(); searchScraper.CrawlString(uri, 0, filters.QueryString, HotItemController.CurrentApi); }); } }