コード例 #1
0
        private void BtnApproveClick(object sender, EventArgs e)
        {
            var curItem = lbxPullRequests.SelectedItem as PullRequest;

            if (curItem == null)
            {
                return;
            }

            var mergeInfo = new MergeRequestInfo
            {
                Id         = curItem.Id,
                Version    = curItem.Version,
                ProjectKey = curItem.DestProjectKey,
                TargetRepo = curItem.DestRepo,
            };

            // Approve
            var approveRequest = new ApprovePullRequest(_settings, mergeInfo);
            var response       = approveRequest.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);
            }
        }
コード例 #2
0
        private void BtnApproveClick(object sender, EventArgs e)
        {
            if (lbxPullRequests.SelectedItem is PullRequest curItem)
            {
                var mergeInfo = new MergeRequestInfo
                {
                    Id         = curItem.Id,
                    Version    = curItem.Version,
                    ProjectKey = curItem.DestProjectKey,
                    TargetRepo = curItem.DestRepo,
                };

                // Approve
                var approveRequest = new ApprovePullRequest(_settings, mergeInfo);
                var response       = ThreadHelper.JoinableTaskFactory.Run(() => approveRequest.SendAsync());
                if (response.Success)
                {
                    MessageBox.Show(_success.Text);
                    ReloadPullRequests();
                }
                else
                {
                    MessageBox.Show(
                        string.Join(Environment.NewLine, response.Messages),
                        _error.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }