示例#1
0
文件: Repo.cs 项目: quandtm/Milestone
 public Repo(Repository repository, IEnumerable<Issue> issues)
 {
     Repository = repository;
     IssueComments = new Dictionary<Issue, ObservableCollection<Comment>>();
     Issues = new ObservableCollection<Issue>(issues);
     Type = RepoType.None;
 }
        public void GetOrganisationUsers(Repository repository)
        {
            Users.Clear();
            Users.Add(new User { Login = "******", Name = "No User" });

            GithubRepository.GetCollaborators(repository.Owner.Login, repository.Name).ContinueWith(t =>
                                      {
                                          // this is a bullshit fix
                                          if (t.Exception != null) return;
                                          ExecuteOnMainThread(() => PopulateUsers(t.Result));
                                      });

            //if (repository.Owner.IsOrganization)
            //{
            //    GithubRepository
            //        .GetOrganisationUsers(repository.Owner.Login)
            //        .ContinueWith(t =>
            //                          {
            //                              // this is a bullshit fix
            //                              if (t.Exception != null) return;
            //                              ExecuteOnMainThread(() => PopulateUsers(t.Result));
            //                          });
            //}
            //else
            //{
            //    PopulateUsers(new[] { repository.Owner });
            //}
        }
        public void GetMilestonesFor(Repository repository)
        {
            if (User == null || repository == null) return;

            if (repository.HasIssues)
            {
                GithubRepository
                .GetMilestones(repository.Owner.Login, repository.Name)
                .ContinueWith(t =>
                {
                    if (t.Exception != null) return;
                    ExecuteOnMainThread(() => PopulateMilestones(t.Result));
                });
            }
        }
        public void GetLabels(Repository repository)
        {
            Labels.Clear();

            if (User == null || repository == null) return;

            if (repository.HasIssues)
            {
                GithubRepository.GetLabels(repository.Owner.Login, repository.Name)
                    .ContinueWith(t => ExecuteOnMainThread(() => PopulateLabels(t.Result)));
            }
        }
 public PullRequestViewModel(PullRequest pr, Repository repo)
 {
     _repo = repo;
     Pull = pr;
 }
示例#6
0
 public Repo(Repository repository, IEnumerable<Issue> issues)
     : this()
 {
     Repository = repository;
     Issues = new ObservableCollection<Issue>(issues);
 }
示例#7
0
 public Repo(Repository repository)
     : this()
 {
     Repository = repository;
 }
 public IssueViewModel(Issue issue, Repository r)
 {
     Issue = issue;
     Repo = r;
 }
        public IEnumerable<User> GetOrganisationUsers(Repository repository)
        {
            var list = new List<User> { new User { Login = "******", Name = "No User" } };

            if (repository.Owner.IsOrganization)
            {
                var result = GithubRepository.GetOrganisationUsers(repository.Owner.Login).Result;

                list.AddRange(result);
            }
            else list.Add(repository.Owner);

            return list;
        }
        public IEnumerable<Milestone> GetMilestones(Repository repository)
        {
            var list = new List<Milestone> { new Milestone { Title = "No Milestone" }};

            if (User == null || repository == null) return list;

            if (repository.HasIssues)
            {
                var result = GithubRepository.GetMilestones(repository.Owner.Login, repository.Name).Result;

                list.AddRange(result);
            }

            return list;
        }
        public IEnumerable<Label> GetLabels(Repository repository)
        {
            var list = new List<Label>();

            if (User == null || repository == null) return list;

            if (repository.HasIssues)
            {
                var result = GithubRepository.GetLabels(repository.Owner.Login, repository.Name).Result;

                list.AddRange(result);
            }

            return list;
        }