public SearchResultCollector(SearchCategory cat) { this.Category = cat; }
public ItemIdentifier(SearchCategory category, IReadOnlyList <SearchResult> dataSource, int item) { this.Category = category; this.DataSource = dataSource; this.Item = item; }
void ShowResult(SearchCategory cat, IReadOnlyList <SearchResult> result) { bool found = false; for (int i = 0; i < incompleteResults.Count; i++) { var ir = incompleteResults [i]; if (ir.Item1 == cat) { incompleteResults[i] = Tuple.Create(cat, result); found = true; break; } } if (!found) { incompleteResults.Add(Tuple.Create(cat, result)); incompleteResults.Sort((x, y) => { return(categories.IndexOf(x.Item1).CompareTo(categories.IndexOf(y.Item1))); }); } //if (incompleteResults.Count == categories.Count) { results.Clear(); results.AddRange(incompleteResults); List <Tuple <SearchCategory, IReadOnlyList <SearchResult> > > failedResults = null; topItem = null; for (int i = 0; i < results.Count; i++) { var tuple = results [i]; try { if (tuple.Item2.Count == 0) { continue; } if (topItem == null || topItem.DataSource[topItem.Item].Weight < tuple.Item2[0].Weight) { topItem = new ItemIdentifier(tuple.Item1, tuple.Item2, 0); } } catch (Exception e) { LoggingService.LogError("Error while showing result " + i, e); if (failedResults == null) { failedResults = new List <Tuple <SearchCategory, IReadOnlyList <SearchResult> > > (); } failedResults.Add(results [i]); continue; } } selectedItem = topItem; if (failedResults != null) { failedResults.ForEach(failedResult => results.Remove(failedResult)); } ShowTooltip(); } }
public ItemIdentifier(SearchCategory category, ISearchDataSource dataSource, int item) { this.Category = category; this.DataSource = dataSource; this.Item = item; }
public SearchResultCollector(SearchPopupWindow parent, SearchCategory cat) { this.parent = parent; this.Category = cat; }