Пример #1
0
        public static void AddInlineAdornment(ITextView view, UIElement uiElement, RoutedEventHandler onLoaded)
        {
            var manager = GetManager(view);

            if (manager != null)
            {
                var adornment = new ZoomableInlineAdornment(uiElement, view);
                // Original Python code unhooked this event after load was complete
                // I don't think this should be needed... we'll see.
                adornment.Loaded += onLoaded;
                manager.AddAdornment(adornment);
            }
        }
        public static void AddInlineAdornment(ITextView view, UIElement uiElement, RoutedEventHandler onLoaded, SnapshotPoint targetLoc)
        {
            var manager = GetManager(view);

            if (manager != null)
            {
                var adornment = new ZoomableInlineAdornment(uiElement, view);
                // Event is unhooked in ReplWindow.  If we don't we'll receive the event multiple
                // times leading to very jerky / hang like behavior where we've setup a new event
                // loop in the repl window.
                adornment.Loaded += onLoaded;
                manager.AddAdornment(adornment, targetLoc);
            }
        }
Пример #3
0
        public void AddAdornment(ZoomableInlineAdornment uiElement, SnapshotPoint targetLoc)
        {
            if (Dispatcher.CurrentDispatcher != _dispatcher)
            {
                _dispatcher.BeginInvoke(new Action(() => AddAdornment(uiElement, targetLoc)));
                return;
            }
            var targetLine = targetLoc.GetContainingLine();

            _tags.Add(new Tuple <SnapshotPoint, ZoomableInlineAdornment>(targetLoc, uiElement));
            var handler = TagsChanged;

            if (handler != null)
            {
                var span = new SnapshotSpan(_textView.TextSnapshot, targetLine.Start, targetLine.LengthIncludingLineBreak);
                var args = new SnapshotSpanEventArgs(span);
                handler(this, args);
            }
        }
Пример #4
0
            public void AddAdornment(ZoomableInlineAdornment uiElement)
            {
                if (Dispatcher.CurrentDispatcher != _dispatcher)
                {
                    _dispatcher.BeginInvoke(new Action(() => AddAdornment(uiElement)));
                    return;
                }
                var caretPos  = _textView.Caret.Position.BufferPosition;
                var caretLine = caretPos.GetContainingLine();

                _tags.Add(new Tuple <int, ZoomableInlineAdornment>(caretPos.Position, uiElement));
                var handler = TagsChanged;

                if (handler != null)
                {
                    var span = new SnapshotSpan(_textView.TextSnapshot, caretLine.Start, caretLine.Length);
                    var args = new SnapshotSpanEventArgs(span);
                    handler(this, args);
                }
            }