public async Task <IEnumerable <GitHubIssue> > GetGitHubIssuesAsync() { //TODO: retrict to a reasonable amount of Issues var issues = await IssuesCollection.OfType <GitHubIssueInternal>().ToListAsync(); return(_mapper.Map <IEnumerable <GitHubIssueInternal>, IEnumerable <GitHubIssue> >(issues)); }
public IssuesViewModel(IApplicationService applicationService) { GoToNewIssueCommand = ReactiveCommand.Create(); GoToNewIssueCommand.Subscribe(_ => { var vm = CreateViewModel <IssueAddViewModel>(); vm.RepositoryOwner = RepositoryOwner; vm.RepositoryName = RepositoryName; vm.CreatedIssue.Where(x => x != null).Subscribe(x => IssuesCollection.Add(x)); ShowViewModel(vm); }); LoadCommand = ReactiveCommand.CreateAsyncTask(t => { var direction = Filter.Ascending ? "asc" : "desc"; var state = Filter.Open ? "open" : "closed"; var sort = Filter.SortType == BaseIssuesFilterModel.Sort.None ? null : Filter.SortType.ToString().ToLower(); var labels = string.IsNullOrEmpty(Filter.Labels) ? null : Filter.Labels; var assignee = string.IsNullOrEmpty(Filter.Assignee) ? null : Filter.Assignee; var creator = string.IsNullOrEmpty(Filter.Creator) ? null : Filter.Creator; var mentioned = string.IsNullOrEmpty(Filter.Mentioned) ? null : Filter.Mentioned; var milestone = Filter.Milestone == null ? null : Filter.Milestone.Value; var request = applicationService.Client.Users[RepositoryOwner].Repositories[RepositoryName].Issues.GetAll( sort: sort, labels: labels, state: state, direction: direction, assignee: assignee, creator: creator, mentioned: mentioned, milestone: milestone); return(IssuesCollection.SimpleCollectionLoad(request, t as bool?)); }); }
public IssuesViewModel(IApplicationService applicationService) { _mineFilter = IssuesFilterModel.CreateMineFilter(applicationService.Account.Username); _filterSelection = this.WhenAnyValue(x => x.Filter) .Select(x => { if (x == null || _openFilter.Equals(x)) { return(IssueFilterSelection.Open); } if (_closedFilter.Equals(x)) { return(IssueFilterSelection.Closed); } if (_mineFilter.Equals(x)) { return(IssueFilterSelection.Mine); } return(IssueFilterSelection.Custom); }) .ToProperty(this, Xamarin => Xamarin.FilterSelection); GoToNewIssueCommand = ReactiveCommand.Create(); GoToNewIssueCommand.Subscribe(_ => { var vm = CreateViewModel <IssueAddViewModel>(); vm.RepositoryOwner = RepositoryOwner; vm.RepositoryName = RepositoryName; vm.CreatedIssue.IsNotNull().Subscribe(IssuesCollection.Add); ShowViewModel(vm); }); GoToCustomFilterCommand = ReactiveCommand.Create(); LoadCommand = ReactiveCommand.CreateAsyncTask(t => { var direction = Filter.Ascending ? "asc" : "desc"; var state = Filter.Open ? "open" : "closed"; var sort = Filter.SortType == BaseIssuesFilterModel.Sort.None ? null : Filter.SortType.ToString().ToLower(); var labels = string.IsNullOrEmpty(Filter.Labels) ? null : Filter.Labels; var assignee = string.IsNullOrEmpty(Filter.Assignee) ? null : Filter.Assignee; var creator = string.IsNullOrEmpty(Filter.Creator) ? null : Filter.Creator; var mentioned = string.IsNullOrEmpty(Filter.Mentioned) ? null : Filter.Mentioned; var milestone = Filter.Milestone == null ? null : Filter.Milestone.Value; var request = applicationService.Client.Users[RepositoryOwner].Repositories[RepositoryName].Issues.GetAll( sort: sort, labels: labels, state: state, direction: direction, assignee: assignee, creator: creator, mentioned: mentioned, milestone: milestone); return(IssuesCollection.SimpleCollectionLoad(request, t as bool?)); }); }
public MyIssuesViewModel(IApplicationService applicationService) { Title = "My Issues"; Filter = MyIssuesFilterModel.CreateOpenFilter(); _selectedFilter = this.WhenAnyValue(x => x.Filter) .Select(x => { if (x == null || _openFilter.Equals(x)) { return(0); } return(_closedFilter.Equals(x) ? 1 : -1); }) .ToProperty(this, x => x.SelectedFilter); this.WhenAnyValue(x => x.Filter).Skip(1).Subscribe(LoadCommand.ExecuteIfCan); //Filter = applicationService.Account.Filters.GetFilter<MyIssuesFilterModel>("MyIssues"); // Issues.GroupFunc = x => // { // var @group = base.Group(model); // if (@group != null) return @group; // // try // { // var regex = new System.Text.RegularExpressions.Regex("repos/(.+)/issues/"); // return model.GroupBy(x => regex.Match(x.Url).Groups[1].Value).ToList(); // } // catch (Exception e) // { // return null; // } // }; LoadCommand = ReactiveCommand.CreateAsyncTask(t => { var filter = Filter.FilterType.ToString().ToLower(); var direction = Filter.Ascending ? "asc" : "desc"; var state = Filter.Open ? "open" : "closed"; var sort = Filter.SortType == BaseIssuesFilterModel.Sort.None ? null : Filter.SortType.ToString().ToLower(); var labels = string.IsNullOrEmpty(Filter.Labels) ? null : Filter.Labels; var request = applicationService.Client.AuthenticatedUser.Issues.GetAll(sort: sort, labels: labels, state: state, direction: direction, filter: filter); return(IssuesCollection.SimpleCollectionLoad(request, t as bool?)); }); }
public async Task <GitHubIssue> GetGitHubIssueAsync(long id) { if (id <= 0) { throw new ArgumentOutOfRangeException("id", "id cannot be less than or equal to zero"); } var issueInternal = await IssuesCollection.OfType <GitHubIssueInternal>().SingleOrDefaultAsync(m => m.Id == id); if (issueInternal == null) { return(null); } else { return(_mapper.Map <GitHubIssueInternal, GitHubIssue>(issueInternal)); } }
public RedmineServiceContext(Uri serviceUri, string apiKey) { _serviceUri = serviceUri; _apiKey = apiKey; _news = new NewsCollection(this); _projects = new ProjectsCollection(this); _issues = new IssuesCollection(this); _users = new UsersCollection(this); _userRoles = new UserRolesCollection(this); _relations = new IssueRelationsCollection(this); _trackers = new IssueTrackersCollection(this); _statuses = new IssueStatusesCollection(this); _priorities = new IssuePrioritiesCollection(this); _categories = new IssueCategoriesCollection(this); _versions = new ProjectVersionsCollection(this); _attachments = new AttachmentsCollection(this); _customFields = new CustomFieldsCollection(this); _queries = new QueriesCollection(this); _syncRoot = new object(); }