private async void TestGetProjects_Click(object sender, EventArgs e) { Models.Projects.Project projects = null; try { projects = await GetProjects?.Invoke(); StringBuilder sb = new StringBuilder(); sb.AppendLine("Authenticated projects:\n"); foreach (var project in projects.value) { sb.AppendLine(project.name); } MessageBox.Show(sb.ToString()); } catch { MessageBox.Show($"Unable to connect to Azure DevOps - check the event viewer", "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error); SetUISuccessOrFailure(false); } if (projects != null && projects.value.Count > 0) { SetUISuccessOrFailure(true); } }
private async void MainForm_Load(object sender, EventArgs e) { Models.Projects.Project projects = null; try { projects = await GetProjects?.Invoke(); } catch { MessageBox.Show($"Unable to connect to the Azure DevOps API start up - check the event view", "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error); SetUISuccessOrFailure(false); } if (projects != null && projects.value.Count > 0) { SetUISuccessOrFailure(true); } }