private void BtnCreateClick(object sender, EventArgs e) { if (ddlBranchSource.SelectedValue == null || ddlBranchTarget.SelectedValue == null || ddlRepositorySource.SelectedValue == null || ddlRepositoryTarget.SelectedValue == null) { return; } var info = new PullRequestInfo { Title = txtTitle.Text, Description = txtDescription.Text, SourceBranch = ddlBranchSource.SelectedValue.ToString(), TargetBranch = ddlBranchTarget.SelectedValue.ToString(), SourceRepo = (Repository)ddlRepositorySource.SelectedValue, TargetRepo = (Repository)ddlRepositoryTarget.SelectedValue, Reviewers = _reviewers }; var pullRequest = new CreatePullRequestRequest(_settings, info); var response = pullRequest.Send(); if (response.Success) { MessageBox.Show(_success.Text); BitbucketViewPullRequestFormLoad(null, null); } else { MessageBox.Show(string.Join(Environment.NewLine, response.Messages), _error.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnCreateClick(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); ThreadHelper.JoinableTaskFactory.Run(async() => { if (ddlBranchSource.SelectedValue == null || ddlBranchTarget.SelectedValue == null || ddlRepositorySource.SelectedValue == null || ddlRepositoryTarget.SelectedValue == null) { return; } var info = new PullRequestInfo { Title = txtTitle.Text, Description = txtDescription.Text, SourceBranch = ddlBranchSource.SelectedValue.ToString(), TargetBranch = ddlBranchTarget.SelectedValue.ToString(), SourceRepo = (Repository)ddlRepositorySource.SelectedValue, TargetRepo = (Repository)ddlRepositoryTarget.SelectedValue, Reviewers = _reviewers }; var pullRequest = new CreatePullRequestRequest(_settings, info); var response = await pullRequest.SendAsync(); await this.SwitchToMainThreadAsync(); if (response.Success) { MessageBox.Show(_success.Text); ReloadPullRequests(); } else { MessageBox.Show(string.Join(Environment.NewLine, response.Messages), _error.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }); }