Exemple #1
0
        private void StartSearch(string searchText)
        {
            this.Cancel(); // may be previous search
            this.cancellationTokenSource = new CancellationTokenSource();
            var token      = this.cancellationTokenSource.Token;
            var criteria   = new FavoritesSearch(this.persistence.Favorites, token, searchText);
            var searchTask = criteria.FindAsync();

            searchTask.ContinueWith(this.FinishSearch, TaskScheduler.FromCurrentSynchronizationContext());
        }
 private List<IFavorite> CallSearch(string phrase)
 {
     var searchEngine = new FavoritesSearch(this.Persistence.Favorites, this.cancelSource.Token, phrase);
     Task<List<IFavorite>> searchTask = searchEngine.FindAsync();
     searchTask.Wait();
     return searchTask.Result;
 }
 private void StartSearch(string searchText)
 {
     this.Cancel(); // may be previous search
     this.cancellationTokenSource = new CancellationTokenSource();
     CancellationToken token = this.cancellationTokenSource.Token;
     var criteria = new FavoritesSearch(this.persistence.Favorites, token, searchText);
     Task<List<IFavorite>> searchTask = criteria.FindAsync();
     searchTask.ContinueWith(this.FinishSearch, TaskScheduler.FromCurrentSynchronizationContext());
 }