public async void Search(int pageNumber) { this.SearchInit(); this.SearchKeyword.Value = this.savedSearchKeyword; try { var keywordList = this.ToKeywordList(this.SearchKeyword.Value); var sw = Stopwatch.StartNew(); var searchResult = new VmSearchResult(await Task.Run(() => this.documentFileService.SearchFile(AppContext.ServerUrl, AppContext.AuthToken, keywordList, new List <string>(), pageNumber, AppContext.CountPerPage))); sw.Stop(); this.SearchFinalize(pageNumber, searchResult, sw.Elapsed.TotalSeconds); } catch (Exception) { } finally { this.status = Status.Wait; this.UpdateControlStatus(); } }
private void SearchFinalize(int pageNumber, VmSearchResult searchResult, double totalSeconds) { this.SearchTime = totalSeconds; this.HitList.Value = searchResult.HitList; this.PageList.Value = new Pagination(searchResult.TotalCount, AppContext.CountPerPage).GetPageList(pageNumber); this.TotalHitCount = searchResult.TotalCount; Logger.Warn(this.HitList.Value.Count); }