Пример #1
0
        private async Task LoadIssueDetails(IssueLoadScenario loadScenario)
        {
            // if we can't parse the number, don't show it.
            if (!txtIssueNumber.CausesValidation || !int.TryParse(txtIssueNumber.Text, out int issueNumber))
            {
                return;
            }

            // try to load the issue from the github and show the title.
            try
            {
                // get the repository
                (string owner, string repo) = UIHelpers.GetRepoOwner(cboAvailableRepos.SelectedItem);

                RepositoryInfo repoFromGH = await _issueManager.GetRepositoryAsync(owner, repo);

                IssueObject issue = loadScenario switch {
                    IssueLoadScenario.BrowseEpic => await _issueManager.GetBrowseableIssueAsync(repoFromGH.Id, issueNumber),
                    IssueLoadScenario.LoadAllIssues => await _issueManager.GetAllIssueAsync(repoFromGH.Id, issueNumber),
                    IssueLoadScenario.LoadIssueAsTemplate => await _issueManager.GetTemplateIssueAsync(repoFromGH.Id, issueNumber),
                    _ => throw new InvalidOperationException("Invalid IssueLoadScenario")
                };

                lblIssueTitle.Text = issue.Title;
            }
            catch
            {
                lblIssueTitle.Text = "!!! Could not find issue !!!";
            }
        }