示例#1
0
        public PromptMargin(IWpfTextViewHost wpfTextViewHost, IEditorFormatMap editorFormatMap)
        {
            _textView        = wpfTextViewHost.TextView;
            _editorFormatMap = editorFormatMap;

            _promptProvider = ReplWindow.FromBuffer(_textView.TextBuffer);
            _promptProvider.MarginVisibilityChanged += new Action(OnMarginVisibilityChanged);

            _visualManager = new PromptMarginVisualManager(this, editorFormatMap);
            _visualManager.MarginVisual.IsVisibleChanged += this.OnIsVisibleChanged;

            OnMarginVisibilityChanged();
        }
示例#2
0
        public void Dispose()
        {
            if (_promptProvider != null)
            {
                _promptProvider.MarginVisibilityChanged -= this.OnMarginVisibilityChanged;
            }

            if (_visualManager != null)
            {
                var visual = _visualManager.MarginVisual;
                if (visual != null)
                {
                    visual.IsVisibleChanged -= this.OnIsVisibleChanged;
                }
            }

            _visualManager = null;
        }