コード例 #1
0
ファイル: CondaPackageManager.cs プロジェクト: xyongy/PTVS
        private async void OnHistoryFileChanged(object sender, EventArgs e)
        {
            if (_isDisposed)
            {
                return;
            }

            InstalledFilesChanged?.Invoke(this, EventArgs.Empty);
            _factory.NotifyImportNamesChanged();

            var cts = new CancellationTokenSource();
            var cancellationToken = cts.Token;
            var oldCts            = Interlocked.Exchange(ref _currentRefresh, cts);

            try {
                oldCts?.Cancel();
                oldCts?.Dispose();
            } catch (ObjectDisposedException) {
            }

            try {
                await CacheInstalledPackagesAsync(false, false, cancellationToken);
            } catch (OperationCanceledException) {
            } catch (Exception ex) when(!ex.IsCriticalException())
            {
                Debug.Fail(ex.ToUnhandledExceptionMessage(GetType()));
            }
        }
コード例 #2
0
ファイル: PipPackageManager.cs プロジェクト: whitestone7/PTVS
        private async void RefreshIsCurrentTimer_Elapsed(object state)
        {
            if (_isDisposed)
            {
                return;
            }

            try {
                _refreshIsCurrentTrigger.Change(Timeout.Infinite, Timeout.Infinite);
            } catch (ObjectDisposedException) {
            }

            InstalledFilesChanged?.Invoke(this, EventArgs.Empty);

            var cts = new CancellationTokenSource();
            var cancellationToken = cts.Token;
            var oldCts            = Interlocked.Exchange(ref _currentRefresh, cts);

            try {
                oldCts?.Cancel();
                oldCts?.Dispose();
            } catch (ObjectDisposedException) {
            }

            try {
                await CacheInstalledPackagesAsync(false, false, cancellationToken);
            } catch (OperationCanceledException) {
            } catch (Exception ex) when(!ex.IsCriticalException())
            {
                Debug.Fail(ex.ToUnhandledExceptionMessage(GetType()));
            }
        }
コード例 #3
0
ファイル: PipPackageManager.cs プロジェクト: yuts/PTVS
        private void RefreshIsCurrentTimer_Elapsed(object state)
        {
            if (_isDisposed)
            {
                return;
            }

            InstalledFilesChanged?.Invoke(this, EventArgs.Empty);

            var cts    = new CancellationTokenSource();
            var oldCts = Interlocked.Exchange(ref _currentRefresh, cts);

            oldCts?.Cancel();
            oldCts?.Dispose();

            CacheInstalledPackagesAsync(false, cts.Token)
            .SilenceException <OperationCanceledException>()
            .DoNotWait();
        }