protected static void DoPostReview(FormSubmit form) { int reviewId = form.GetSelectedReviewId(); List <string> changes = form.GetCheckedFullPaths(); BackgroundWorker backgroundPostReview = new BackgroundWorker(); backgroundPostReview.WorkerReportsProgress = true; backgroundPostReview.WorkerSupportsCancellation = true; backgroundPostReview.DoWork += (s, e) => { string server = form.textBoxServer.Text; string username = form.textBoxUsername.Text; string password = form.textBoxPassword.Text; string submitAs = null; bool publish = false; PostReview.PostReviewOpen open = PostReview.PostReviewOpen.Internal; bool debug = false; e.Result = PostReview.Submit(backgroundPostReview, server, username, password, submitAs, reviewId, changes, publish, open, debug); if (backgroundPostReview.CancellationPending) { e.Cancel = true; } }; string label = String.Format("Uploading Code Review #{0} ({1} files)...", reviewId, changes.Count); FormProgress progress = new FormProgress("Uploading...", label, backgroundPostReview); progress.FormClosed += (s, e) => { bool close = true; PostReview.PostReviewException pre = (PostReview.PostReviewException)progress.Error; if (pre != null) { StringBuilder message = new StringBuilder(); message.AppendLine(pre.ToString()); message.AppendLine(); message.AppendLine("Click \"Retry\" to return to dialog, or \"Cancel\" to return to Visual Studio."); if (MessageBox.Show(form, message.ToString(), "ERROR", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Retry) { close = false; } } if (close) { form.Review = progress.Result as PostReview.ReviewInfo; form.DialogResult = DialogResult.OK; form.Close(); } }; progress.ShowDialog(form); }
protected static void DoPostReview(FormSubmit form) { int reviewId = form.GetSelectedReviewId(); List<string> changes = form.GetCheckedFullPaths(); BackgroundWorker backgroundPostReview = new BackgroundWorker(); backgroundPostReview.WorkerReportsProgress = true; backgroundPostReview.WorkerSupportsCancellation = true; backgroundPostReview.DoWork += (s, e) => { string server = form.textBoxServer.Text; string username = form.textBoxUsername.Text; string password = form.textBoxPassword.Text; string submitAs = null; bool publish = false; PostReview.PostReviewOpen open = PostReview.PostReviewOpen.Internal; bool debug = false; e.Result = PostReview.Submit(backgroundPostReview, server, username, password, submitAs, reviewId, changes, publish, open, debug); if (backgroundPostReview.CancellationPending) { e.Cancel = true; } }; string label = String.Format("Uploading Code Review #{0} ({1} files)...", reviewId, changes.Count); FormProgress progress = new FormProgress("Uploading...", label, backgroundPostReview); progress.FormClosed += (s, e) => { bool close = true; PostReview.PostReviewException pre = (PostReview.PostReviewException)progress.Error; if (pre != null) { StringBuilder message = new StringBuilder(); message.AppendLine(pre.ToString()); message.AppendLine(); message.AppendLine("Click \"Retry\" to return to dialog, or \"Cancel\" to return to Visual Studio."); if (MessageBox.Show(form, message.ToString(), "ERROR", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Retry) { close = false; } } if (close) { form.Review = progress.Result as PostReview.ReviewInfo; form.DialogResult = DialogResult.OK; form.Close(); } }; progress.ShowDialog(form); }
private void ShowFormSubmit() { FormSubmit form = new FormSubmit(solutionTracker.Changes); if (form.ShowDialog() == DialogResult.OK) { PostReview.ReviewInfo reviewInfo = form.Review; if (reviewInfo != null) { VsBrowseUrl(reviewInfo.Uri); } } }