Beispiel #1
0
        public async Task SearchAsync()
        {
            // Cancel any existing continuous search operation.
            OverallSearchCancellationTokenSource?.Cancel();
            if (SearchTask != null)
            {
                await SearchTask.CatchExceptions(NU);
            }

            // Create a CancellationTokenSource for the search we're about to perform.
            BeginListening();
            OverallSearchCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(ListeningTask_CancellationTokenSource.Token);

            SearchTask = SearchAsync(null, OverallSearchCancellationTokenSource.Token);
            await SearchTask;
        }