private void Sprint_SelectionChanged(object sender, SelectionChangedEventArgs e) { var sprint = (SprintListItem)Sprint.SelectedItem; if (sprint != null && sprint.Id != issueResponse.SprintId) { newSprint = sprint; SprintConfirmButtonVisibility = Visibility.Visible; } else { SprintConfirmButtonVisibility = Visibility.Hidden; } }
private async void ConfirmSprint_Click(object sender, RoutedEventArgs e) { (HttpStatusCode StatusCode, string ResponseContent)response = (HttpStatusCode.NotFound, "Something went wrong"); switch (issueResponse.IssueType) { case ProjectManagementView.Contracts.Issues.Enums.IssueType.Task: response = await mainWindow.CommandQueryDispatcher.SendAsync(new AssignTaskToSprint(newSprint.Id), $"api/project-management/projects/{projectId}/tasks/{issueId}/assign-to-sprint", HttpOperationType.PATCH); break; case ProjectManagementView.Contracts.Issues.Enums.IssueType.Nfr: response = await mainWindow.CommandQueryDispatcher.SendAsync(new AssignNfrToSprint(newSprint.Id), $"api/project-management/projects/{projectId}/nfrs/{issueId}/assign-to-sprint", HttpOperationType.PATCH); break; case ProjectManagementView.Contracts.Issues.Enums.IssueType.Subtask: response = await mainWindow.CommandQueryDispatcher.SendAsync(new AssignSubtaskToSprint(newSprint.Id), $"api/project-management/projects/{projectId}/tasks/{issueResponse.LinkedTo.IssueId}/subtasks/{issueId}/assign-to-sprint", HttpOperationType.PATCH); break; case ProjectManagementView.Contracts.Issues.Enums.IssueType.Bug: if (issueResponse.IsLinkedIssue) { if (issueResponse.LinkedTo.IssueType == IssueType.Task) { response = await mainWindow.CommandQueryDispatcher.SendAsync(new AssignTasksBugToSprint(newSprint.Id), $"api/project-management/projects/{projectId}/tasks/{issueResponse.LinkedTo.IssueId}/bugs/{issueId}/assign-to-sprint", HttpOperationType.PATCH); } else { response = await mainWindow.CommandQueryDispatcher.SendAsync(new AssignNfrsBugToSprint(newSprint.Id), $"api/project-management/projects/{projectId}/nfrs/{issueResponse.LinkedTo.IssueId}/bugs/{issueId}/assign-to-sprint", HttpOperationType.PATCH); } } else { response = await mainWindow.CommandQueryDispatcher.SendAsync(new AssignBugToSprint(newSprint.Id), $"api/project-management/projects/{projectId}/bugs/{issueId}/assign-to-sprint", HttpOperationType.PATCH); } break; } if (response.StatusCode != HttpStatusCode.OK) { MessageBox.Show(response.ResponseContent); return; } newSprint = null; SprintConfirmButtonVisibility = Visibility.Hidden; }