Пример #1
0
        private async Task <IssueList> GetIssueList()
        {
            var client = new GitHubClient(new ProductHeaderValue(_appSettings.GithubOwner));

            client.Credentials = new Credentials(_appSettings.GithubApiKey);

            var repos = await client.Repository.Get(_appSettings.GithubOwner, _appSettings.RepositoryName);

            var issues = await client.Issue.GetAllForRepository(repos.Id);

            var issueList = new IssueList();

            foreach (var issue in issues.Where(w => w.ClosedAt == null))
            {
                var tmp = new GithubIssue()
                {
                    Id       = issue.Id,
                    Title    = issue.Title,
                    Body     = issue.Body,
                    Created  = issue.CreatedAt,
                    IsClosed = issue.Locked
                };

                issueList.GithubIssues.Add(tmp);
            }

            return(issueList);
        }
        public void SaveWindowInfo()
        {
            _cfgAcccess.IssuesCredential.userid   = IssueReportHelper.EncryptString(txtUserID);
            _cfgAcccess.IssuesCredential.password = IssueReportHelper.EncryptString(txtPassword);

            List <Repository> repositories = new List <Repository>(_cfgAcccess.Repositories);

            foreach (Issue issue in gridItems)
            {
                int nIndex = 0;
                foreach (Repository rep in _cfgAcccess.Repositories)
                {
                    if (issue.Repository.CompareTo(rep.Name) == 0)
                    {
                        int  nCount = 0;
                        bool bExist = false;
                        if (rep.githubissues != null)
                        {
                            foreach (GithubIssue gitissue in rep.githubissues)
                            {
                                if (gitissue.number == issue.Number)
                                {
                                    _cfgAcccess.Repositories[nIndex].githubissues[nCount].assignee = issue.Assignee;
                                    bExist = true;
                                    break;
                                }
                                nCount++;
                            }
                        }
                        if (!bExist)
                        {
                            GithubIssue [] array   = _cfgAcccess.Repositories[nIndex].githubissues;
                            int            newsize = _cfgAcccess.Repositories[nIndex].githubissues != null? _cfgAcccess.Repositories[nIndex].githubissues.Length + 1:1;
                            Array.Resize(ref array, newsize);
                            GithubIssue ghIssue = new GithubIssue();
                            ghIssue.assignee   = issue.Assignee;
                            ghIssue.number     = issue.Number;
                            array[newsize - 1] = ghIssue;
                            _cfgAcccess.Repositories[nIndex].githubissues = array;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    nIndex++;
                }
            }
            //_cfgAcccess.Repositories = cmbRepositories;

            _cfgAcccess.SelectedRepository = SelectedRepository;

            _cfgAcccess.SavetoConfigData();
        }
Пример #3
0
 public bool Equals(GithubIssue other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.Id, Id));
 }
        private void UpdateAdapter(GithubIssue issue, TaskItem outlookTaskItem)
        {
            var itemAdapter = new GithubTaskAdapter(outlookTaskItem);

            itemAdapter.Title = issue.Title;
            itemAdapter.Body  = issue.Body;

            if (!outlookTaskItem.Saved)
            {
                outlookTaskItem.Save();
            }
        }
 private void CreateOrUpdateTask(GithubIssue issue, TaskItem outlookTaskItem, IItems items)
 {
     if (outlookTaskItem != null)
     {
         UpdateAdapter(issue, outlookTaskItem);
     }
     else
     {
         using (var newItem = ((TaskItem)items.Add(OlItemType.olTaskItem)).WithComCleanupProxy())
         {
             UpdateAdapter(issue, newItem);
         }
     }
 }
Пример #6
0
        public IActionResult OnPostAsync()
        {
            var issue = new GithubIssue
            {
                Title       = Input.Title,
                Description = Input.Description
            };

            var prediction = _githubIssueLabeler.PredictLabel(issue);

            PredictedArea = prediction.Area;

            return(Page());
        }
Пример #7
0
        public IActionResult OnPostAsync()
        {
            var issue = new GithubIssue
            {
                Title       = Input.Title,
                Description = Input.Description
            };

            var prediction = _predictionEnginePool.Predict(
                modelName: "GithubIssueClassifier",
                example: issue);

            PredictedArea = prediction.Area;

            return(Page());
        }
Пример #8
0
 public static ManagerPantsMeta GetMeta(GithubIssue issue)
 {
     return(GetMeta(issue.Body));
 }
Пример #9
0
        static GithubIssuePost ToPostIssue(GithubIssue issue)
        {
            StringBuilder body = new StringBuilder();
            body.AppendFormat("Created by @{0} on {1}{2}", issue.User.Login, issue.Created_at.ToString(DATE_TIME_FORMATTING), NEW_LINE);

            if (issue.State == "closed")
            {
                body.AppendFormat("Closed on {0}{1}", issue.Closed_at.ToString(DATE_TIME_FORMATTING), NEW_LINE);
            }

            body.Append(HORIZONTAL_ROW);

            body.Append(issue.body);

            return new GithubIssuePost
                {
                    title = issue.title,
                    body = body.ToString(),
                };
        }
Пример #10
0
 public bool Equals(GithubIssue other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.Id, Id);
 }