public static void Load(this Repo repo, BinaryReader reader, int fileVersion) { repo.Repository = new Repository(); repo.Repository.Name = reader.ReadString(); repo.Type = (RepoType)reader.ReadInt16(); repo.Repository.HasIssues = reader.ReadBoolean(); repo.Repository.Owner = reader.ReadString(); var numIssues = reader.ReadInt32(); repo.Repository.IsFork = reader.ReadBoolean(); for (int i = 0; i < numIssues; i++) { var issue = new Issue(); var oc = new ObservableCollection<Comment>(); issue.Load(reader, fileVersion, ref oc); repo.Issues.Add(issue); repo.IssueComments.Add(issue, oc); } }
public void DownloadIssueComments(Context context, Repo r, Issue i, Action<Repo> callback) { //_client.Issues. _client.Issues.GetCommentsAsync(r.Repository.Owner, r.Repository.Name, i.Number, comments => Dispatcher.BeginInvoke(() => { if (r.IssueComments.ContainsKey(i)) r.IssueComments[i].Clear(); else r.IssueComments.Add(i, new ObservableCollection<Comment>()); foreach (var c in comments) { r.IssueComments[i].Add(c); } callback(r); }), _exceptionAction); }
public IssueViewModel(Issue issue, Repository r) { Issue = issue; Repo = r; }
public ValidationResult<Issue> CreateIssue() { if (User == null || SelectedProject == null || string.IsNullOrWhiteSpace(Title) || string.IsNullOrWhiteSpace(Body)) return ValidationResult<Issue>.Failure("Please enter all details"); string assigned; if (AssignedUser == null || AssignedUser.Login == "No User") assigned = null; else assigned = AssignedUser.Login; int? milestone; if (SelectedMilestone == null || SelectedMilestone.Title == "No Milestone") milestone = null; else milestone = SelectedMilestone.Number; string[] selectedLabels = Labels.Where(l => l.IsChecked).Select(l => l.Name).ToArray(); var result = new Issue(); try { result = githubRepository.CreateIssue(User.Login, SelectedProject.Name, Title, Body, assigned, milestone, selectedLabels).Result; } catch (Exception ex) { return ValidationResult<Issue>.Failure("Error Uploading Issue: " + ex.Message); } return ValidationResult<Issue>.Success.WithData(result); }