/// <summary> /// Creats and add a listView with all Pull Request to the GUI asynchronous /// </summary> private static async Task ListPullRequest() { var PRDialog = new Dialog("Pull Requests", 0, 0) { Width = Dim.Percent(90), Height = Dim.Percent(90) }; var PRList = new List <string>(); var PrView = new ListView(PRList) { X = 1, Y = 4, Width = Dim.Fill() - 4, Height = Dim.Fill() - 1 }; PRDialog.Add(PrView); var seperator = "--------------------------------------------------------------------------------------------------"; var response = new PullRequestResponse(); try { response = await PullRequestService.GetAllPR(orgTokList, settings); if (response != null) { foreach (var org in response.Organizations) { if (org.Success) { PRList.Add(seperator); var organization = "************ Org Name: " + org.OrganizationName + " ***************"; PRList.Add(organization); foreach (var rep in org.Repositories) { if (rep.PullRequests.Length != 0) { var repoName = "--REPO NAME--: " + rep.Name; PRList.Add(repoName); foreach (var pr in rep.PullRequests) { var pullReqcont = " contributor: " + pr.DisplayName; var pullReqTitleDesc = " Title/Description: " + pr.Title + "/" + pr.Description; var pullReqUri = " Uri: " + pr.Url; PRList.Add(pullReqcont); PRList.Add(pullReqTitleDesc); PRList.Add(pullReqUri); } } } PRList.Add(seperator); } else { var errorMessage = "Organiazation with name: " + "'" + org.OrganizationName + "' could not be found"; var adviceMessage = "Please check name spelling and access token"; PRList.Add(seperator); PRList.Add(errorMessage); PRList.Add(adviceMessage); PRList.Add(seperator); } } } else if (response == null && orgTokList.Count != 0) { PRList.Add("CONNECTION ERROR, Check settings or internet connection"); } else if (response == null && orgTokList.Count == 0) { PRList.Add("NO ORGANIZATIONS ARE ADDED"); } else { if (PRList.Count == 0) { PRList.Add("NO PULL REQEUSTS ARE AVAILABLE AT THE MOMOENT"); } } } catch (Exception ex) { PRList.Add("Warning: Please check app Settings or internet Connection! "); PRList.Add("Http exception: " + ex.Message); } Button retrn = new Button("Return") { X = Pos.Center(), Y = Pos.AnchorEnd(1), Clicked = () => { Application.RequestStop(); } }; PRDialog.Add(retrn); Application.Run(PRDialog); }