Exemplo n.º 1
0
        private void ObserveBuilds(DateTime?sinceDate, bool?running, IObserver <BuildInfo> observer, CancellationToken cancellationToken)
        {
            try
            {
                var builds = _tfsHelper.QueryBuilds().AsQueryable();
                if (sinceDate.HasValue)
                {
                    builds = builds.Where(b => b.StartDate > sinceDate.Value);
                }
                if (running.HasValue)
                {
                    builds = builds.Where(b => b.IsFinished != running.Value);
                }

                Parallel.ForEach(builds, detail => { observer.OnNext(CreateBuildInfo(detail)); });
            }
            catch (OperationCanceledException)
            {
                // Do nothing, the observer is already stopped
            }
            catch (Exception ex)
            {
                observer.OnError(ex);
            }
        }
Exemplo n.º 2
0
        private void ObserveBuilds(DateTime?sinceDate, bool?running, IObserver <BuildInfo> observer, CancellationToken cancellationToken)
        {
            try
            {
                var builds = _tfsHelper.QueryBuilds(sinceDate, running);

                Parallel.ForEach(builds, detail => { observer.OnNext(CreateBuildInfo(detail)); });
            }
            catch (OperationCanceledException)
            {
                // Do nothing, the observer is already stopped
            }
            catch (Exception ex)
            {
                observer.OnError(ex);
            }
        }