Beispiel #1
0
        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);
            }
        }
        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(Tuple.Create(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);
            }
        }