public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag)
        {
            InheritanceTag inheritanceTag = tag as InheritanceTag;

            if (inheritanceTag == null)
            {
                return(null);
            }

            string imageName;

            switch (inheritanceTag.Glyph)
            {
            case InheritanceGlyph.HasImplementations:
                imageName = "has-implementations";
                break;

            case InheritanceGlyph.Implements:
                imageName = "implements";
                break;

            case InheritanceGlyph.ImplementsAndHasImplementations:
                imageName = "override-is-overridden-combined";
                break;

            case InheritanceGlyph.ImplementsAndOverridden:
                imageName = "override-is-overridden-combined";
                break;

            case InheritanceGlyph.Overridden:
                imageName = "is-overridden";
                break;

            case InheritanceGlyph.Overrides:
                imageName = "overrides";
                break;

            case InheritanceGlyph.OverridesAndOverridden:
                imageName = "override-is-overridden-combined";
                break;

            default:
                return(null);
            }

            BitmapSource source = new BitmapImage(new Uri("pack://application:,,,/Tvl.VisualStudio.InheritanceMargin;component/Resources/" + imageName + ".png"));
            Image        image  = new Image()
            {
                Source = source
            };

            image.CommandBindings.Add(new CommandBinding(InheritanceMarginPackage.InheritanceTargetsList, inheritanceTag.HandleExecutedInheritanceTargetsList, inheritanceTag.HandleCanExecuteInheritanceTargetsList));

            inheritanceTag.MarginGlyph = image;

            return(image);
        }
Пример #2
0
        private IEnumerable <InheritanceTag> GetInheritanceGlyphTagsStartingOnLine(ITextViewLine textViewLine)
        {
            ITextBuffer visualBuffer = _textViewHost.TextView.TextViewModel.VisualBuffer;
            ITextBuffer textBuffer   = _textViewHost.TextView.TextBuffer;

            foreach (IMappingTagSpan <IGlyphTag> iteratorVariable2 in _glyphTagAggregator.GetTags(textViewLine.ExtentAsMappingSpan))
            {
                InheritanceTag tag = iteratorVariable2.Tag as InheritanceTag;
                if (tag != null)
                {
                    SnapshotPoint?point             = iteratorVariable2.Span.Start.GetPoint(visualBuffer, PositionAffinity.Predecessor);
                    SnapshotPoint?iteratorVariable5 = iteratorVariable2.Span.Start.GetPoint(textBuffer, PositionAffinity.Predecessor);
                    if (point.HasValue && iteratorVariable5.HasValue && iteratorVariable5.Value >= textViewLine.Start && iteratorVariable5.Value <= textViewLine.End)
                    {
                        yield return(tag);
                    }
                }
            }
        }