コード例 #1
0
        /// <summary>
        ///     Cancels the search matching the specified <paramref name="id"/>, if it is in progress.
        /// </summary>
        /// <param name="id">The unique identifier for the search.</param>
        /// <returns>A value indicating whether the search was sucessfully cancelled.</returns>
        public bool TryCancel(Guid id)
        {
            if (CancellationTokens.TryGetValue(id, out var cts))
            {
                cts.Cancel();
                return(true);
            }

            return(false);
        }
コード例 #2
0
 public void CancelTask(int externalRepositoryId)
 {
     CancellationTokens.TryGetValue(externalRepositoryId, out var tokenSource);
     tokenSource?.Cancel();
 }