Esempio n. 1
0
        protected override Task Load()
        {
            string filter    = Issues.Filter.FilterType.ToString().ToLower();
            string direction = Issues.Filter.Ascending ? "asc" : "desc";
            string state     = Issues.Filter.Open ? "open" : "closed";
            string sort      = Issues.Filter.SortType == MyIssuesFilterModel.Sort.None ? null : Issues.Filter.SortType.ToString().ToLower();
            string labels    = string.IsNullOrEmpty(Issues.Filter.Labels) ? null : Issues.Filter.Labels;

            var request = this.GetApplication().Client.AuthenticatedUser.Issues.GetAll(sort: sort, labels: labels, state: state, direction: direction, filter: filter);

            return(Issues.SimpleCollectionLoad(request));
        }
        protected override Task Load(bool forceCacheInvalidation)
        {
            LinkedList <Tuple <string, string> > filter = new LinkedList <Tuple <string, string> >();
            var issuesFilter = Issues.Filter;

            if (issuesFilter != null)
            {
                if (issuesFilter.Status != null && !issuesFilter.Status.IsDefault())
                {
                    foreach (var a in PropertyToUrl("status", issuesFilter.Status))
                    {
                        filter.AddLast(a);
                    }
                }
                if (issuesFilter.Kind != null && !issuesFilter.Kind.IsDefault())
                {
                    foreach (var a in PropertyToUrl("kind", issuesFilter.Kind))
                    {
                        filter.AddLast(a);
                    }
                }
                if (issuesFilter.Priority != null && !issuesFilter.Priority.IsDefault())
                {
                    foreach (var a in PropertyToUrl("priority", issuesFilter.Priority))
                    {
                        filter.AddLast(a);
                    }
                }
                if (!string.IsNullOrEmpty(issuesFilter.AssignedTo))
                {
                    if (issuesFilter.AssignedTo.Equals("unassigned"))
                    {
                        filter.AddLast(new Tuple <string, string>("responsible", ""));
                    }
                    else
                    {
                        filter.AddLast(new Tuple <string, string>("responsible", issuesFilter.AssignedTo));
                    }
                }
                if (!string.IsNullOrEmpty(issuesFilter.ReportedBy))
                {
                    filter.AddLast(new Tuple <string, string>("reported_by", issuesFilter.ReportedBy));
                }

                filter.AddLast(new Tuple <string, string>("sort", ((IssuesFilterModel.Order)issuesFilter.OrderBy).ToString().ToLower()));
            }

            return(Issues.SimpleCollectionLoad(() => this.GetApplication().Client.Users[Username].Repositories[Repository].Issues.GetIssues(0, 50, filter).Issues));
        }
Esempio n. 3
0
        public Task Load(bool forceDataRefresh)
        {
            string direction = _issues.Filter.Ascending ? "asc" : "desc";
            string state     = _issues.Filter.Open ? "open" : "closed";
            string sort      = _issues.Filter.SortType == IssuesFilterModel.Sort.None ? null : _issues.Filter.SortType.ToString().ToLower();
            string labels    = string.IsNullOrEmpty(_issues.Filter.Labels) ? null : _issues.Filter.Labels;
            string assignee  = string.IsNullOrEmpty(_issues.Filter.Assignee) ? null : _issues.Filter.Assignee;
            string creator   = string.IsNullOrEmpty(_issues.Filter.Creator) ? null : _issues.Filter.Creator;
            string mentioned = string.IsNullOrEmpty(_issues.Filter.Mentioned) ? null : _issues.Filter.Mentioned;
            string milestone = _issues.Filter.Milestone == null ? null : _issues.Filter.Milestone.Value;

            var request = Application.Client.Users[User].Repositories[Slug].Issues.GetAll(sort: sort, labels: labels, state: state, direction: direction,
                                                                                          assignee: assignee, creator: creator, mentioned: mentioned, milestone: milestone);

            return(Issues.SimpleCollectionLoad(request, forceDataRefresh));
        }