public override void SaveIssue(Repository repository, NewIssue newIssue) { var issue = new Issue(null, null, null, 69, ItemState.Open, newIssue.Title, newIssue.Body, null, null, null, null, 0, null, null, DateTimeOffset.Now, null); AllIssues.Add(issue); Issue = issue; }
public override async void UpdateIssue(Repository repository, int id, IssueUpdate update) { try { Issue issueUpdate = await _github.Issue.Update(repository.Owner.Login, repository.Name, id, update); if (Repository != null && repository.Id == Repository.Repository.Id) { foreach (var issue in AllIssues) { if (issue.Number == issueUpdate.Number) { AllIssues.Remove(issue); AllIssues.Insert(0, issueUpdate); Issue = issueUpdate; break; } } } } catch (Exception exception) { _log.Write(LogLevel.Error, "Failed to save issue.", exception); } }
public override async void CloseIssue(Issue issue, string comment) { if (!string.IsNullOrWhiteSpace(comment)) { AddComment(issue, comment); } if (Repository == null) { return; } var update = new IssueUpdate(); update.State = ItemState.Closed; try { var updatedIssue = await _github.Issue.Update(Repository.Repository.Owner.Login, Repository.Repository.Name, issue.Number, update); if (updatedIssue.State == ItemState.Closed) { AllIssues.Remove(issue); Issue = null; IssueMarkdown = string.Empty; } } catch (Exception exception) { _log.Write(LogLevel.Error, "Failed to update issue.", exception); } }
public override async void GetIssuesAndResolvePortedTfsIssue(TfsWorkItem item, string title) { if (_gettingIssues) { return; } _gettingIssues = true; AllIssues.Clear(); OnPropertyChanged("Issues"); var wrapper = Repository; if (wrapper != null && wrapper.Repository != null) { var repository = wrapper.Repository; var request = new RepositoryIssueRequest(); request.State = ItemState.Open; request.Filter = IssueFilter.All; await GetIssues(repository.Owner.Login, repository.Name, request); // Resolve and close TFS issue var matchingIssues = AllIssues.Where(i => i.Title == title); if (matchingIssues.Any()) { var number = matchingIssues.Max(i => i.Number); var issue = matchingIssues.FirstOrDefault(i => i.Number == number); if (issue != null) { item.Resolve(issue); } } } _gettingIssues = false; }
public override void Logout() { _log.Write(LogLevel.Info, "Logging out of GitHub"); base.Logout(); SettingsCache.Credentials = null; User = null; Repositories.Clear(); Organizations.Clear(); AllIssues.Clear(); OnPropertyChanged("Issues"); }
public override void SaveIssue(Repository repository, NewIssue newIssue) { var issue = new Issue { Number = 69, Title = newIssue.Title, Body = newIssue.Body }; AllIssues.Add(issue); Issue = issue; }
public override void GetIssues() { var issue = new Issue(null, null, null, 1, ItemState.Open, "title", "##body##", new User("https://avatars.githubusercontent.com/u/493828?v=1", null, null, 1, null, DateTimeOffset.Now, 1, "*****@*****.**", 1, 1, true, null, 1, 1, null, "user", "name", 1, null, 0, 0, 0, null, false), null, null, null, 1, null, null, DateTimeOffset.Now, null); AllIssues.Add(issue); Issue = issue; IssueMarkdown = issue.Body; }
public override async void SaveIssue(Repository repository, NewIssue newIssue) { try { Issue issue = await _github.Issue.Create(repository.Owner.Login, repository.Name, newIssue); if (issue != null && Repository != null && repository.Id == Repository.Repository.Id) { AllIssues.Insert(0, issue);; Issue = issue; } } catch (Exception exception) { _log.Write(LogLevel.Error, "Failed to save issue.", exception); } }
private async Task GetIssues(string owner, string name, RepositoryIssueRequest request) { _log.Write(LogLevel.Debug, "Fetching issues for {0}/{1}", owner, name); try { var issues = await _github.Issue.GetForRepository(owner, name, request); foreach (var issue in issues) { AllIssues.Add(issue); } } catch (Exception ex) { _log.Write(LogLevel.Warn, "Failed to fetch issues", ex); } OnPropertyChanged("Issues"); }
public override void GetIssues() { var issue = new Issue { Body = "##body##", Number = 1, State = ItemState.Open, Title = "title", User = new User { Login = "******", Name = "name", AvatarUrl = "https://avatars.githubusercontent.com/u/493828?v=1" } }; AllIssues.Add(issue); Issue = issue; IssueMarkdown = issue.Body; }
public override async void GetIssues() { if (_gettingIssues) { return; } _gettingIssues = true; AllIssues.Clear(); OnPropertyChanged("Issues"); var wrapper = Repository; if (wrapper != null && wrapper.Repository != null) { var repository = wrapper.Repository; var request = new RepositoryIssueRequest(); request.State = ItemState.Open; request.Filter = IssueFilter.All; await GetIssues(repository.Owner.Login, repository.Name, request); } _gettingIssues = false; }