Exemple #1
0
        internal DiscussionBox(Discussion discussion, DiscussionEditor editor, User mergeRequestAuthor, User currentUser,
                               int diffContextDepth, IGitRepository gitRepository, ColorScheme colorScheme,
                               Action <DiscussionBox> preContentChange, Action <DiscussionBox> onContentChanged)
        {
            Discussion          = discussion;
            _editor             = editor;
            _mergeRequestAuthor = mergeRequestAuthor;
            _currentUser        = currentUser;

            _diffContextDepth    = new ContextDepth(0, diffContextDepth);
            _tooltipContextDepth = new ContextDepth(5, 5);
            _formatter           = new DiffContextFormatter();
            if (gitRepository != null)
            {
                _panelContextMaker   = new EnhancedContextMaker(gitRepository);
                _tooltipContextMaker = new CombinedContextMaker(gitRepository);
            }
            _colorScheme = colorScheme;

            _preContentChange = preContentChange;
            _onContentChanged = onContentChanged;

            _toolTip = new ToolTip
            {
                AutoPopDelay = 5000,
                InitialDelay = 500,
                ReshowDelay  = 100
            };

            _toolTipNotifier = new ToolTip();

            _htmlToolTip = new HtmlToolTip
            {
                AutoPopDelay   = 10000, // 10s
                BaseStylesheet = ".htmltooltip { padding: 1px; }"
            };

            onCreate();
        }
Exemple #2
0
        private void createDiscussionBoxes(List <Discussion> discussions)
        {
            foreach (var discussion in discussions)
            {
                if (!SystemFilter.DoesMatchFilter(discussion))
                {
                    continue;
                }

                DiscussionEditor editor = _manager.GetDiscussionEditor(_mergeRequestDescriptor, discussion.Id);
                DiscussionBox    box    = new DiscussionBox(discussion, editor, _mergeRequestAuthor, _currentUser,
                                                            _diffContextDepth, _gitRepository, _colorScheme,
                                                            (sender) =>
                {
                    SuspendLayout();
                    sender.Visible = false; // to avoid flickering on repositioning
                }, (sender) => updateLayout(null))
                {
                    // Let new boxes be hidden to avoid flickering on repositioning
                    Visible = false
                };
                Controls.Add(box);
            }
        }