void AddIssue(object parameter) { SelectedIssue = null; // Unselects last selection. Essential, as assignment below won't clear other control's SelectedItems var issue = new Model.Issue(); SelectedIssue = issue; }
public static async Task <List <Model.Issue> > GetIssues(DataAccess.Repository selectedrepo, ReportType reportype) { List <Model.Issue> issues = new List <Model.Issue>(); var recently = new RepositoryIssueRequest { Filter = IssueFilter.All, Since = DateTimeOffset.Now.Subtract(TimeSpan.FromDays((int)reportype)) }; if (selectedrepo.Name.CompareTo("ALL REPOSITORIES") == 0) { foreach (DataAccess.Repository repo in _repolist) { var issuesForAnet = await GithubClient.Issue.GetAllForRepository("AuthorizeNet", repo.Name, recently); //var issuesForAnet = await GithubClient.PullRequest.GetAllForRepository("AuthorizeNet", repo.Name, recently); foreach (Octokit.Issue issue in issuesForAnet) { Model.Issue iss = new Model.Issue(); iss.Assignee = issue.Assignee != null ? issue.Assignee.Name : ""; iss.Comments = issue.Comments; iss.IsPullRequest = (issue.PullRequest != null); iss.Labels = issue.Labels.Count > 0 ? string.Join(" | ", from item in issue.Labels select item.Name) : " "; if (iss.Comments > 0) { var commentsforissue = await GithubClient.Issue.Comment.GetAllForIssue(repo.owner, repo.Name, issue.Number); DateTime lasttime = DateTime.Now; foreach (IssueComment cmnt in commentsforissue) { iss.CommentedBy += cmnt.User.Login + ","; lasttime = cmnt.UpdatedAt.Value.DateTime; iss.AllComments += cmnt.User.Login + "\t\t\t\t" + lasttime.ToString() + "\n\n" + cmnt.Body + "\n\n"; } iss.LastCommentedAt = lasttime; iss.LastCommentedAge = (int)(DateTime.Now - iss.LastCommentedAt).TotalDays; } iss.Number = issue.Number; iss.IDLink = issue.HtmlUrl; iss.Repository = repo.Name;// issue.Repository!=null? issue.Repository.Name:""; iss.Title = issue.Title; iss.Description = issue.Body; iss.CreatedAt = issue.CreatedAt.DateTime; iss.User = issue.User.Login; iss.CreationAge = (int)(DateTime.Now - issue.CreatedAt).TotalDays; issues.Add(iss); } } } else { var issuesForAnet = await GithubClient.Issue.GetAllForRepository("AuthorizeNet", selectedrepo.Name, recently); foreach (Octokit.Issue issue in issuesForAnet) { Model.Issue iss = new Model.Issue(); iss.Assignee = issue.Assignee != null ? issue.Assignee.Name : ""; iss.Comments = issue.Comments; iss.IsPullRequest = (issue.PullRequest != null); iss.Labels = issue.Labels.Count > 0 ? string.Join(" | ", from item in issue.Labels select item.Name) : " "; if (iss.Comments > 0) { var commentsforissue = await GithubClient.Issue.Comment.GetAllForIssue(selectedrepo.owner, selectedrepo.Name, issue.Number); DateTime lasttime = DateTime.Now; foreach (IssueComment cmnt in commentsforissue) { iss.CommentedBy += cmnt.User.Login + ","; lasttime = cmnt.UpdatedAt.Value.DateTime; iss.AllComments += cmnt.User.Login + "\t\t\t\t" + lasttime.ToString() + "\n\n" + cmnt.Body + "\n\n"; } iss.LastCommentedAt = lasttime; iss.LastCommentedAge = (int)(DateTime.Now - iss.LastCommentedAt).TotalDays; } iss.Number = issue.Number; iss.IDLink = issue.HtmlUrl; iss.Repository = selectedrepo.Name;// issue.Repository!=null? issue.Repository.Name:""; iss.Title = issue.Title; iss.Description = issue.Body; iss.CreatedAt = issue.CreatedAt.DateTime; iss.User = issue.User.Login; iss.CreationAge = (int)(DateTime.Now - issue.CreatedAt).TotalDays; issues.Add(iss); } } return(issues); }