public Properties(string path, Content reviewProperties, string reviewId, string summary, string description, string testing, string jiraId, List <string> groups, RB_Tools.Shared.Review.Properties.Level level, bool copiesAsAdds) { Path = path; Contents = reviewProperties; ReviewId = reviewId; Summary = summary; Description = description; Testing = testing; JiraId = jiraId; Groups = groups; ReviewLevel = level; CopiesAsAdds = copiesAsAdds; }
// // Starts a review // private void button_CreateReview_Click(object sender, EventArgs e) { // We need a sumary before we raise the review if (string.IsNullOrWhiteSpace(textBox_Summary.Text) == true) { MessageBox.Show(this, "You need to provide a summary before you can post a review", "Unable to post review", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Do we need a Jira ticket? if (Settings.Settings.Default.JiraRequired == true) { if (string.IsNullOrWhiteSpace(textBox_JiraId.Text) == true) { MessageBox.Show(this, "You need to provide a Jira ticket before you can continue", "Unable to post review", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } // Only bother checking against the reviewboard server if we are doing a review RB_Tools.Shared.Review.Properties.Level reviewLevel = (RB_Tools.Shared.Review.Properties.Level)comboBox_ReviewLevel.SelectedIndex; if (reviewLevel == RB_Tools.Shared.Review.Properties.Level.FullReview) { string reviewboardServer = Names.Url[(int)Names.Type.Reviewboard]; if (Credentials.Available(reviewboardServer) == false) { m_logger.Log("Requesting Reviewboard credentials"); DialogResult dialogResult = MessageBox.Show(this, "You must be authenticated with the Reviewboard server before generating a review.\n\nDo you want to authenticate now?", "Authentication Error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { RB_Tools.Shared.Authentication.Targets.Reviewboard.Authenticate(m_logger); } // Check if we're still unauthenticated if (Credentials.Available(reviewboardServer) == false) { m_logger.Log("Credentials still unavailable"); return; } } } // Check Jira authentication if needed if (string.IsNullOrWhiteSpace(textBox_JiraId.Text) == false) { string jiraServer = Names.Url[(int)Names.Type.Jira]; if (Credentials.Available(jiraServer) == false) { m_logger.Log("Requesting Jira credentials"); DialogResult dialogResult = MessageBox.Show(this, "You must be authenticated with the Jira server before continuing.\n\nDo you want to authenticate now?", "Authentication Error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { RB_Tools.Shared.Authentication.Targets.Jira.Authenticate(m_logger); } // Check if we're still unauthenticated if (Credentials.Available(jiraServer) == false) { m_logger.Log("Credentials still unavailable"); return; } } } // Save the state of our review groups SaveSelectedReviewGroups(); // Update our state UpdateCreateReviewDialogState(State.PostReview); // Do we need to keep our artifacts? if (checkBox_KeepArtifacts.Checked == true) { Utilities.Storage.KeepAssets(textBox_Summary.Text, m_logger); } Utilities.Storage.Keep(m_originalRequest, "Original File List.txt", false, m_logger); // Build up the list of review groups List <string> selectedReviewGroups = new List <string>(); foreach (int thisIndex in checkedListBox_ReviewGroups.CheckedIndices) { Reviewboard.ReviewGroup thisGroup = m_reviewGroups[thisIndex]; selectedReviewGroups.Add(thisGroup.InternalName); } // Build up the properties of this review Review.Review.Properties reviewProperties = new Review.Review.Properties( m_requestDirectory, m_reviewSource, textBox_ReviewId.Text, textBox_Summary.Text, textBox_Description.Text, textBox_Testing.Text, textBox_JiraId.Text.Trim().Replace(" ", ""), selectedReviewGroups, reviewLevel, checkBox_CopiesAsAdds.Checked ); // Trigger the correct state depending on whether we are reviewing TriggerReviewRequest(reviewProperties); }