public ProjectViewModel(ITfProject model)
        {
            _model = model;
            _model.RepositoriesUpdated += (sender, args) => OnRepositoriesUpdated();

            Repositories = new ObservableCollection <RepositoryViewModel>();
        }
예제 #2
0
        public Task <IEnumerable <ITfGitRepository> > GetRepositoriesInProject(ITfProject project)
        {
            var task = Task.Run(() =>
            {
                var getRepositoriesTask = _gitHttpClient.Value.GetRepositoriesAsync(project.Id);

                getRepositoriesTask.Wait();

                return(getRepositoriesTask.Result.Select(repo => _repositoryFactory.Create(repo, project)));
            });

            return(task);
        }
예제 #3
0
        public Task <IEnumerable <IPullRequest> > GetActivePullRequestsInProject(ITfProject project)
        {
            var task = Task.Run(() =>
            {
                var getPullRequestsTask = _gitHttpClient.Value.GetPullRequestsByProjectAsync(project.Id,
                                                                                             ActivePullRequestSearchCriteria);

                getPullRequestsTask.Wait();

                var result = new List <IPullRequest>();
                foreach (var pullRequest in getPullRequestsTask.Result)
                {
                    var repo = project.Repositories.FirstOrDefault(rep => rep.Id == pullRequest.Repository.Id) ??
                               _repositoryFactory.Create(pullRequest.Repository, project);

                    result.Add(_pullRequestFactory.Create(pullRequest, _serverConnection.Uri.AbsoluteUri, repo));
                }

                return(result.AsEnumerable());
            });

            return(task);
        }
예제 #4
0
 public TfGitRepository(GitRepository gitRepository, ITfProject project)
 {
     _gitRepository = gitRepository;
     Project        = project;
 }