コード例 #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);
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
0
            public void PreprocessMouseRightButtonUp(System.Windows.Input.MouseButtonEventArgs e)
            {
                var manager = InlineReplAdornmentProvider.GetManager(_view);

                if (manager != null)
                {
                    var over = System.Windows.Input.Mouse.PrimaryDevice.DirectlyOver as System.Windows.FrameworkElement;
                    while (over != null)
                    {
                        ZoomableInlineAdornment adornment = over as ZoomableInlineAdornment;
                        if (adornment != null)
                        {
                            adornment.ContextMenu.IsOpen = true;
                            e.Handled = true;
                            break;
                        }
                        over = over.Parent as System.Windows.FrameworkElement;
                    }
                }
            }