private void createDiscussionBoxes(IEnumerable <Discussion> discussions) { foreach (Discussion discussion in discussions) { if (!SystemFilter.DoesMatchFilter(discussion)) { continue; } SingleDiscussionAccessor accessor = Shortcuts.GetSingleDiscussionAccessor( _gitLabInstance, _modificationListener, _mergeRequestKey, discussion.Id); DiscussionBox box = new DiscussionBox(this, accessor, _git, _currentUser, _mergeRequestKey.ProjectKey, discussion, _mergeRequestAuthor, _diffContextDepth, _colorScheme, // pre-content-change (sender) => { SuspendLayout(); sender.Visible = false; // to avoid flickering on repositioning }, // post-content-change (sender, lite) => { // 'lite' means that there were no a preceding PreContentChange event, so we did not suspend layout updateLayout(null, true, lite); updateSearch(); _onDiscussionModified?.Invoke(); }, sender => MostRecentFocusedDiscussionControl = sender) { // Let new boxes be hidden to avoid flickering on repositioning Visible = false }; Controls.Add(box); } }
internal DiscussionBox( CustomFontForm parent, SingleDiscussionAccessor accessor, IGitCommandService git, User currentUser, ProjectKey projectKey, Discussion discussion, User mergeRequestAuthor, int diffContextDepth, ColorScheme colorScheme, Action <DiscussionBox> preContentChange, Action <DiscussionBox, bool> onContentChanged, Action <Control> onControlGotFocus) { Parent = parent; Discussion = discussion; _accessor = accessor; _editor = accessor.GetDiscussionEditor(); _mergeRequestAuthor = mergeRequestAuthor; _currentUser = currentUser; _imagePath = StringUtils.GetHostWithPrefix(projectKey.HostName) + "/" + projectKey.ProjectName; _diffContextDepth = new ContextDepth(0, diffContextDepth); _tooltipContextDepth = new ContextDepth(5, 5); if (git != null) { _panelContextMaker = new EnhancedContextMaker(git); _tooltipContextMaker = new CombinedContextMaker(git); } _colorScheme = colorScheme; _preContentChange = preContentChange; _onContentChanged = onContentChanged; _onControlGotFocus = onControlGotFocus; _htmlDiffContextToolTip = new HtmlToolTip { AutoPopDelay = 20000, // 20s InitialDelay = 300 }; _htmlDiscussionNoteToolTip = new HtmlToolTip { AutoPopDelay = 20000, // 20s InitialDelay = 300, }; _specialDiscussionNoteMarkdownPipeline = MarkDownUtils.CreatePipeline(Program.ServiceManager.GetJiraServiceUrl()); onCreate(); }
private void createDiscussionBoxes(IEnumerable <Discussion> discussions) { foreach (Discussion discussion in discussions) { SingleDiscussionAccessor accessor = _shortcuts.GetSingleDiscussionAccessor( _mergeRequestKey, discussion.Id); DiscussionBox box = new DiscussionBox(this, accessor, _git, _currentUser, _mergeRequestKey.ProjectKey, discussion, _mergeRequestAuthor, _colorScheme, onDiscussionBoxContentChanging, onDiscussionBoxContentChanged, sender => _mostRecentFocusedDiscussionControl = sender, _htmlTooltip, _discussionLayout.DiffContextPosition, _discussionLayout.DiscussionColumnWidth, _discussionLayout.NeedShiftReplies) { // Let new boxes be hidden to avoid flickering on repositioning Visible = false }; if (box.HasNotes) { Controls.Add(box); } } }