コード例 #1
0
        public InheritanceMargin(
            IThreadingContext threadingContext,
            IStreamingFindUsagesPresenter streamingFindUsagesPresenter,
            ClassificationTypeMap classificationTypeMap,
            IClassificationFormatMap classificationFormatMap,
            IUIThreadOperationExecutor operationExecutor,
            InheritanceMarginTag tag,
            IWpfTextView textView,
            IAsynchronousOperationListener listener)
        {
            _threadingContext             = threadingContext;
            _streamingFindUsagesPresenter = streamingFindUsagesPresenter;
            _workspace         = tag.Workspace;
            _operationExecutor = operationExecutor;
            _textView          = textView;
            _listener          = listener;
            InitializeComponent();

            var viewModel = InheritanceMarginViewModel.Create(classificationTypeMap, classificationFormatMap, tag, textView.ZoomLevel);

            DataContext             = viewModel;
            ContextMenu.DataContext = viewModel;
            ToolTip = new ToolTip {
                Content = viewModel.ToolTipTextBlock, Style = (Style)FindResource("ToolTipStyle")
            };
        }
コード例 #2
0
        public InheritanceMargin(
            IThreadingContext threadingContext,
            IStreamingFindUsagesPresenter streamingFindUsagesPresenter,
            ClassificationTypeMap classificationTypeMap,
            IClassificationFormatMap classificationFormatMap,
            IUIThreadOperationExecutor operationExecutor,
            InheritanceMarginTag tag,
            IWpfTextView textView)
        {
            _threadingContext             = threadingContext;
            _streamingFindUsagesPresenter = streamingFindUsagesPresenter;
            _workspace         = tag.Workspace;
            _operationExecutor = operationExecutor;
            _textView          = textView;
            InitializeComponent();

            // ZoomLevel of textView is percentage based. (e.g. 20 -> 400 means 20% -> 400%)
            // and the scaleFactor of CrispImage is 1 based. (e.g 1 means 100%)
            var scaleFactor = textView.ZoomLevel;
            var viewModel   = InheritanceMarginViewModel.Create(classificationTypeMap, classificationFormatMap, tag, scaleFactor);

            DataContext             = viewModel;
            ContextMenu.DataContext = viewModel;
            ToolTip = new ToolTip {
                Content = viewModel.ToolTipTextBlock, Style = (Style)FindResource("ToolTipStyle")
            };
        }
コード例 #3
0
        public static InheritanceMarginViewModel Create(
            ClassificationTypeMap classificationTypeMap,
            IClassificationFormatMap classificationFormatMap,
            InheritanceMarginTag tag,
            double scaleFactor)
        {
            var members = tag.MembersOnLine;

            if (members.Length == 1)
            {
                var member = tag.MembersOnLine[0];

                // Here we want to show a classified text with loc text,
                // e.g. 'Bar' is inherited.
                // But the classified text are inlines, so can't directly use string.format to generate the string
                var inlines = member.DisplayTexts.ToInlines(classificationFormatMap, classificationTypeMap);
                var startOfThePlaceholder = ServicesVSResources._0_is_inherited.IndexOf("{0}", StringComparison.Ordinal);
                var prefixString          = ServicesVSResources._0_is_inherited[..startOfThePlaceholder];