Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
 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);
 }