private void onDiscussionBoxContentChanged(DiscussionBox sender) { SuspendLayout(); // Avoid repositioning child controls on changing sender visibility updateVisibilityOfBox(sender); ResumeLayout(true); // Put child controls at their places ContentChanged?.Invoke(); }
private void updateVisibilityOfBox(DiscussionBox box) { if (box?.Discussion == null) { return; } bool isAllowedToDisplay = _displayFilter.DoesMatchFilter(box.Discussion); // Note that the following does not change Visible property value until Form gets Visible itself box.Visible = isAllowedToDisplay; }
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); } } }
private void onDiscussionBoxContentChanging(DiscussionBox sender) { SuspendLayout(); // Avoid repositioning child controls on changing sender visibility sender.Visible = false; // hide sender to avoid flickering on repositioning ResumeLayout(false); // Don't perform layout immediately, will be done in next callback }