Example #1
0
 public void ReportComplete(IVsSearchTask pTask, uint dwResultsFound)
 {
     if (!this.taskCompletionSource.Task.IsCompleted && !this.taskCompletionSource.Task.IsCanceled)
     {
         this.taskCompletionSource.SetResult(true);
     }
 }
 private void StopSearch(SearchCallbackShim callbackShim)
 {
     if (this.searchTask != null)
     {
         var localSearchTask = this.searchTask;
         this.searchTask = null;
         localSearchTask.Stop();
         //callbackShim?.Cancel();
     }
 }
        private Task StartSearch(string searchString, SearchCallbackShim callbackShim)
        {
            this.StopSearch(callbackShim: null);

            this.searchTask = searchProvider.CreateSearch(
                ++cookie,
                new SearchQueryShim(searchString),
                callbackShim);
            this.searchTask.Start();

            return(callbackShim.Task);
        }
Example #4
0
        public void ReportResults(IVsSearchTask pTask, uint dwResults, IVsSearchItemResult[] pSearchItemResults)
        {
            if (dwResults != pSearchItemResults.Length)
            {
                throw new ArgumentException("Count must match array length or be lesser");
            }

            for (uint i = 0; i < dwResults; i++)
            {
                this.ReportResult(pTask, pSearchItemResults[i]);
            }
        }
        public void NuGetSearchProviderValidateCreateSearchNonNull()
        {
            // Arrange
            Mock <OleMenuCommand>            managePackageCommand    = new Mock <OleMenuCommand>(null, null);
            Mock <OleMenuCommandService>     menuCommandService      = new Mock <OleMenuCommandService>(new Mock <IServiceProvider>().Object);
            NuGetSearchProvider              searchProvider          = new NuGetSearchProvider(menuCommandService.Object, managePackageCommand.Object, managePackageCommand.Object);
            Mock <IVsSearchQuery>            pSearchQuery            = new Mock <IVsSearchQuery>();
            Mock <IVsSearchProviderCallback> pSearchProviderCallback = new Mock <IVsSearchProviderCallback>();

            // Act
            IVsSearchTask searchTask = searchProvider.CreateSearch(1, pSearchQuery.Object, pSearchProviderCallback.Object);

            // Assert
            Assert.NotNull(searchTask);
        }
        public void NuGetSearchProviderValidateCreateSearchNilCookie()
        {
            // Arrange
            Mock <OleMenuCommand>            managePackageCommand    = new Mock <OleMenuCommand>(null, null);
            Mock <OleMenuCommandService>     menuCommandService      = new Mock <OleMenuCommandService>(new Mock <IServiceProvider>().Object);
            NuGetSearchProvider              searchProvider          = new NuGetSearchProvider(menuCommandService.Object, managePackageCommand.Object, managePackageCommand.Object);
            Mock <IVsSearchQuery>            pSearchQuery            = new Mock <IVsSearchQuery>();
            Mock <IVsSearchProviderCallback> pSearchProviderCallback = new Mock <IVsSearchProviderCallback>();

            // Act
            IVsSearchTask searchTask = searchProvider.CreateSearch(dwCookie: VSConstants.VSCOOKIE_NIL, pSearchQuery: pSearchQuery.Object, pSearchCallback: pSearchProviderCallback.Object);

            // Assert
            Assert.Null(searchTask);
        }
 public void ReportResults(IVsSearchTask pTask, uint dwResults, IVsSearchItemResult[] pSearchItemResults)
 {
 }
 public void ReportResult(IVsSearchTask pTask, IVsSearchItemResult pSearchItemResult)
 {
     pSearchItemResult.InvokeAction();
 }
 public void ReportComplete(IVsSearchTask pTask, uint dwResultsFound)
 {
 }
 public void ReportProgress(IVsSearchTask pTask, uint dwProgress, uint dwMaxProgress)
 {
 }
 public void ReportResults(IVsSearchTask pTask, uint dwResults, IVsSearchItemResult[] pSearchItemResults)
 {
 }
 public void ReportResult(IVsSearchTask pTask, IVsSearchItemResult pSearchItemResult)
 {
     pSearchItemResult.InvokeAction();
 }
 public void ReportComplete(IVsSearchTask pTask, uint dwResultsFound)
 {
 }
 public void ReportProgress(IVsSearchTask pTask, uint dwProgress, uint dwMaxProgress)
 {
 }
Example #15
0
 public void ReportResult(IVsSearchTask pTask, IVsSearchItemResult pSearchItemResult)
 => this.searchCallback.AddItem(new SearchItemResultShim(pSearchItemResult));
Example #16
0
 public void ReportProgress(IVsSearchTask pTask, uint dwProgress, uint dwMaxProgress)
 {
     // TODO: report progress.
 }