Esempio n. 1
0
        private void _pullRequestsList_SelectedIndexChanged(object sender, EventArgs e)
        {
            var prevPri = _currentPullRequestInfo;

            if (_pullRequestsList.SelectedItems.Count != 1)
            {
                _currentPullRequestInfo    = null;
                _discussionWB.DocumentText = "";
                _diffViewer.ViewText("", "");
                return;
            }

            _currentPullRequestInfo = _pullRequestsList.SelectedItems[0].Tag as IPullRequestInformation;
            if (prevPri != null && prevPri.Equals(_currentPullRequestInfo))
            {
                return;
            }

            if (_currentPullRequestInfo == null)
            {
                return;
            }
            _discussionWB.DocumentText = DiscussionHtmlCreator.CreateFor(_currentPullRequestInfo);
            _diffViewer.ViewPatch("");
            _fileStatusList.GitItemStatuses = null;

            LoadDiffPatch();
            LoadDiscussion();
        }
        public static string CreateFor(IPullRequestInformation currentPullRequestInfo, List<IDiscussionEntry> entries)
        {
            var html = new StringBuilder();
            AddLine(html, "<html><body><style type='text/css'>");
            html.Append(CssData);
            AddLine(html, "</style>");

            if (entries != null)
            {
                foreach (var entry in entries)
                {
                    var cde = entry as ICommitDiscussionEntry;

                    AddLine(html, "<div class='entry {0}'>", cde == null ? "commentEntry" : " commitEntry");

                    AddLine(html, "<div class='heading'>");
                    AddLine(html, "<span class='created'>{0}</span>\r\n", entry.Created);
                    AddLine(html, "<span class='author'>{0}</span>\r\n", entry.Author);
                    if (cde != null)
                        AddLine(html, "<span class='commit'>Commit:  {0}</span>\r\n", cde.Sha);
                    AddLine(html, "</div>");
                    AddLine(html, "<div class='commentBody'>{0}</div>\r\n", entry.Body);

                    AddLine(html, "</div>");
                }
            }

            AddLine(html, "</body></html>");

            return html.ToString();
        }
        public static string CreateFor(IPullRequestInformation currentPullRequestInfo, List <IDiscussionEntry> entries)
        {
            var html = new StringBuilder();

            AddLine(html, "<html><body><style type='text/css'>");
            html.Append(CssData);
            AddLine(html, "</style>");

            if (entries != null)
            {
                foreach (var entry in entries)
                {
                    var cde = entry as ICommitDiscussionEntry;

                    AddLine(html, "<div class='entry {0}'>", cde == null ? "commentEntry" : " commitEntry");

                    AddLine(html, "<div class='heading'>");
                    AddLine(html, "<span class='created'>{0}</span>\r\n", entry.Created);
                    AddLine(html, "<span class='author'>{0}</span>\r\n", entry.Author);
                    if (cde != null)
                    {
                        AddLine(html, "<span class='commit'>Commit:  {0}</span>\r\n", cde.Sha);
                    }
                    AddLine(html, "</div>");
                    AddLine(html, "<div class='commentBody'>{0}</div>\r\n", entry.Body);

                    AddLine(html, "</div>");
                }
            }

            AddLine(html, "</body></html>");

            return(html.ToString());
        }
        private void _pullRequestsList_SelectedIndexChanged(object sender, EventArgs e)
        {
            var prevPri = _currentPullRequestInfo;

            if (_pullRequestsList.SelectedItems.Count != 1)
            {
                _currentPullRequestInfo    = null;
                _discussionWB.DocumentText = "";
                ThreadHelper.JoinableTaskFactory.RunAsync(
                    () => _diffViewer.ViewTextAsync("", ""));
                return;
            }

            _currentPullRequestInfo = _pullRequestsList.SelectedItems[0].Tag as IPullRequestInformation;
            if (prevPri != null && prevPri.Equals(_currentPullRequestInfo))
            {
                return;
            }

            if (_currentPullRequestInfo == null)
            {
                return;
            }

            _currentPullRequestInfo.HeadRepo.CloneProtocol = _cloneGitProtocol;

            _discussionWB.DocumentText = DiscussionHtmlCreator.CreateFor(_currentPullRequestInfo);
            _diffViewer.ViewPatch(null);
            _fileStatusList.SetDiffs();

            LoadDiffPatch();
            LoadDiscussion();
        }
Esempio n. 5
0
        private void _pullRequestsList_SelectedIndexChanged(object sender, EventArgs e)
        {
            var prevPri = _currentPullRequestInfo;

            if (_pullRequestsList.SelectedItems.Count != 1)
            {
                _currentPullRequestInfo    = null;
                _discussionWB.DocumentText = "";
                _diffViewer.Clear();
                return;
            }

            _currentPullRequestInfo = _pullRequestsList.SelectedItems[0].Tag as IPullRequestInformation;
            if (prevPri is not null && prevPri.Equals(_currentPullRequestInfo))
            {
                return;
            }

            if (_currentPullRequestInfo is null)
            {
                return;
            }

            _currentPullRequestInfo.HeadRepo.CloneProtocol = _cloneGitProtocol;

            _discussionWB.DocumentText = DiscussionHtmlCreator.CreateFor(_currentPullRequestInfo);
            _diffViewer.Clear();
            _fileStatusList.ClearDiffs();

            LoadDiffPatch();
            LoadDiscussion();
        }
 public static string CreateFor(IPullRequestInformation currentPullRequestInfo)
 {
     return(CreateFor(currentPullRequestInfo, null));
 }
        private void _pullRequestsList_SelectedIndexChanged(object sender, EventArgs e)
        {
            var prevPri = _currentPullRequestInfo;

            if (_pullRequestsList.SelectedItems.Count != 1)
            {
                _currentPullRequestInfo = null;
                _discussionWB.DocumentText = "";
                _diffViewer.ViewText("", "");
                return;
            }

            _currentPullRequestInfo = _pullRequestsList.SelectedItems[0].Tag as IPullRequestInformation;
            if (prevPri != null && prevPri.Equals(_currentPullRequestInfo))
                return;

            if (_currentPullRequestInfo == null)
                return;
            _discussionWB.DocumentText = DiscussionHtmlCreator.CreateFor(_currentPullRequestInfo);
            _diffViewer.ViewPatch("");
            _fileStatusList.GitItemStatuses = new List<GitItemStatus>();

            LoadDiffPatch();
            LoadDiscussion();
        }
 public static string CreateFor(IPullRequestInformation currentPullRequestInfo)
 {
     return CreateFor(currentPullRequestInfo, null);
 }