当前位置: 首页>>代码示例>>C#>>正文


C# IWpfTextViewHost类代码示例

本文整理汇总了C#中IWpfTextViewHost的典型用法代码示例。如果您正苦于以下问题:C# IWpfTextViewHost类的具体用法?C# IWpfTextViewHost怎么用?C# IWpfTextViewHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IWpfTextViewHost类属于命名空间,在下文中一共展示了IWpfTextViewHost类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateMargin

        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost view_host, IWpfTextViewMargin container_margin)
        {
            IWpfTextView text_view = view_host.TextView;

            try
            {
                Utils.VSVersion = Assembly.GetCallingAssembly().GetName().Version.Major.ToString();
            }
            catch { }

            if (!PresenceSent)
            {
                PresenceSent = true;
                MonitoringService.SendPresense();
            }

            if (!SettingsLoaded)
                ReadSettings(OptionsService.GlobalOptions);

            RemoveVerticalScrollBar(container_margin);

            var navigator = TextStructureNavigatorService.GetTextStructureNavigator(text_view.TextBuffer);
            var format = FormatMapService.GetEditorFormatMap(text_view);
            var tagger = HighlightWordTagger.Instance(text_view, format, TextSearchService, navigator);
            var marks_enumerator = new MarksEnumerator(AggregatorFactoryService, text_view);
            var change_enumerator = new ChangeEnumerator(AggregatorFactoryService, text_view);
            var words_enumerator = new HighlightedWordsEnumerator(text_view, tagger);

            return new RockMargin(text_view, marks_enumerator, change_enumerator, words_enumerator, tagger);
        }
开发者ID:shashClp,项目名称:RockMargin,代码行数:30,代码来源:RockMarginFactory.cs

示例2: OverviewMarkMargin

 /// <summary>
 /// Constructor for the OverviewChangeTrackingMargin.
 /// </summary>
 private OverviewMarkMargin(
     IWpfTextViewHost textViewHost,
     IVerticalScrollBar scrollBar,
     OverviewMarkMarginProvider provider)
 {
     _markMarginElement = new MarkMarginElement(textViewHost.TextView, scrollBar, provider);
 }
开发者ID:filipivc,项目名称:OverviewMargins,代码行数:10,代码来源:OverviewMarkMargin.cs

示例3: GlyphMouseProcessor

 public GlyphMouseProcessor(IWpfTextViewHost host, IWpfTextViewMargin margin, ITagAggregator<IGlyphTag> aggregator)
 {
     this.theHost = host;
     this.theMargin = margin;
     this.tagAggregator = aggregator;
     this.theHost.Closed += OnTextViewHostClosed;
 }
开发者ID:ssatta,项目名称:viasfora,代码行数:7,代码来源:OutliningGlyphFactoryProvider.cs

示例4: CreateMargin

        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            if (!ExtensibilityToolsPackage.Options.ShowBottomMargin)
                return null;

            return new BottomMargin(wpfTextViewHost.TextView, _classifierService, _documentService);
        }
开发者ID:NotYours180,项目名称:ExtensibilityTools,代码行数:7,代码来源:BottomMarginFactory.cs

示例5: LinkBanner

        IWpfTextViewMargin IWpfTextViewMarginProvider.CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            // If the notification has occured then there is nothing else to do.  We are done
            if (_vimApplicationSettings.HaveNotifiedBackspaceSetting)
            {
                return null;
            }

            // On the very first IVimBuffer creation the vimrc will be loaded.  Go ahead and
            // attempt to get / create the buffer to ensure the vimrc load has been attempted
            var wpfTextView = wpfTextViewHost.TextView;
            IVimBuffer vimBuffer;
            if (!_vim.TryGetOrCreateVimBufferForHost(wpfTextView, out vimBuffer))
            {
                return null;
            }

            // If there is no vimrc or the load does allow backspace over start then there
            // is no need to display the warning
            if (_vim.GlobalSettings.IsBackspaceStart || _vimApplicationSettings.UseEditorTabAndBackspace)
            {
                return null;
            }

            var editorFormatMap = _editorFormatMapService.GetEditorFormatMap(wpfTextView);
            var linkBanner = new LinkBanner();
            linkBanner.MarginName = Name;
            linkBanner.LinkAddress = "https://github.com/jaredpar/VsVim/wiki/FAQ#wiki-backspace";
            linkBanner.LinkText = "FAQ";
            linkBanner.BannerText = "You may want to change the backspace setting in your vimrc";
            linkBanner.Background = editorFormatMap.GetBackgroundBrush(EditorFormatDefinitionNames.Margin, MarginFormatDefinition.DefaultColor);
            linkBanner.CloseClicked += (sender, e) => { _vimApplicationSettings.HaveNotifiedBackspaceSetting = true; };
            return linkBanner;
        }
开发者ID:honeyhoneywell,项目名称:VsVim,代码行数:34,代码来源:BackspaceNotificationMarginProvider.cs

示例6: GetAssociatedMouseProcessor

 public IMouseProcessor GetAssociatedMouseProcessor(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin)
 {
     return new GlyphMouseProcessor(
     wpfTextViewHost, margin,
     aggregatorFactory.CreateTagAggregator<IGlyphTag>(wpfTextViewHost.TextView.TextBuffer)
     );
 }
开发者ID:ssatta,项目名称:viasfora,代码行数:7,代码来源:OutliningGlyphFactoryProvider.cs

示例7: GlyphTextMarkerServiceMouseProcessor

		public GlyphTextMarkerServiceMouseProcessor(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin) {
			if (glyphTextMarkerServiceImpl == null)
				throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl));
			if (wpfTextViewHost == null)
				throw new ArgumentNullException(nameof(wpfTextViewHost));
			if (margin == null)
				throw new ArgumentNullException(nameof(margin));
			glyphTextViewMarkerService = GlyphTextViewMarkerService.GetOrCreate(glyphTextMarkerServiceImpl, wpfTextViewHost.TextView);
			this.wpfTextViewHost = wpfTextViewHost;
			this.margin = margin;
			toolTipDispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, margin.VisualElement.Dispatcher);
			popup = new Popup { AllowsTransparency = true };

			var list = new List<IGlyphTextMarkerMouseProcessor>();
			foreach (var lazy in glyphTextMarkerServiceImpl.GlyphTextMarkerMouseProcessorProviders) {
				if (lazy.Metadata.TextViewRoles != null && !wpfTextViewHost.TextView.Roles.ContainsAny(lazy.Metadata.TextViewRoles))
					continue;
				var mouseProcessor = lazy.Value.GetAssociatedMouseProcessor(wpfTextViewHost, margin);
				if (mouseProcessor != null)
					list.Add(mouseProcessor);
			}
			glyphTextMarkerMouseProcessors = list.ToArray();
			wpfTextViewHost.TextView.Closed += TextView_Closed;
			wpfTextViewHost.TextView.LayoutChanged += TextView_LayoutChanged;
			toolTipDispatcherTimer.Tick += ToolTipDispatcherTimer_Tick;
			popup.Closed += Popup_Closed;
			glyphTextViewMarkerService.AddGlyphTextMarkerListener(this);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:28,代码来源:GlyphTextMarkerServiceMouseProcessor.cs

示例8: TryGetMarginCore

        protected IMarginCore TryGetMarginCore(IWpfTextViewHost textViewHost)
        {
            MarginCore marginCore;
            if (textViewHost.TextView.Properties.TryGetProperty(typeof(MarginCore), out marginCore))
                return marginCore;

            // play nice with other source control providers
            ITextView textView = textViewHost.TextView;
            ITextDataModel textDataModel = textView != null ? textView.TextDataModel : null;
            ITextBuffer documentBuffer = textDataModel != null ? textDataModel.DocumentBuffer : null;
            if (documentBuffer == null)
                return null;

            ITextDocument textDocument;
            if (!TextDocumentFactoryService.TryGetTextDocument(documentBuffer, out textDocument))
                return null;

            //var filename = textDocument.FilePath;
            //var repositoryPath = GitCommands.GetGitRepository(Path.GetFullPath(filename));
            //if (repositoryPath == null)
            //    return null;

            return textViewHost.TextView.Properties.GetOrCreateSingletonProperty(
                        () => new MarginCore(textViewHost.TextView, ClassificationFormatMapService, EditorFormatMapService));
        }
开发者ID:laurentkempe,项目名称:PReview,代码行数:25,代码来源:DiffMarginFactoryBase.cs

示例9: CreateMargin

        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            string source = textViewHost.TextView.TextBuffer.CurrentSnapshot.GetText();
            ITextDocument document;

            if (textViewHost.TextView.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(ITextDocument), out document))
            {
                switch (textViewHost.TextView.TextBuffer.ContentType.DisplayName)
                {
                    case "LESS":
                        bool showLess = WESettings.GetBoolean(WESettings.Keys.ShowLessPreviewWindow);
                        return new LessMargin("CSS", source, showLess, document);

                    //case "scss":
                    //    return new ScssMargin("CSS", source, true, document);

                    case "CoffeeScript":
                        bool showCoffee = WESettings.GetBoolean(WESettings.Keys.ShowCoffeeScriptPreviewWindow);
                        return new CoffeeScriptMargin("JavaScript", source, showCoffee, document);

                    //case "TypeScript":
                    //    if (!document.FilePath.EndsWith(".d.ts"))
                    //    {
                    //        bool showType = WESettings.GetBoolean(WESettings.Keys.ShowTypeScriptPreviewWindow);
                    //        return new TypeScriptMargin("TypeScript", source, showType, document);
                    //    }
                    //    break;

                    case "markdown":
                        return new MarkdownMargin("text", source, true, document);
                }
            }

            return null;
        }
开发者ID:joeriks,项目名称:WebEssentials2013,代码行数:35,代码来源:EditorMarginFactory.cs

示例10: SimpleScrollBar

        public SimpleScrollBar(IWpfTextViewHost host, IWpfTextViewMargin containerMargin, FrameworkElement container,
            IScrollMapFactoryService scrollMapFactoryService)
        {
            _textView = host.TextView;

            _realScrollBarMargin =
                containerMargin.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar) as IWpfTextViewMargin;
            if (_realScrollBarMargin != null)
            {
                _realScrollBar = _realScrollBarMargin as IVerticalScrollBar;
                if (_realScrollBar != null)
                {
                    _realScrollBarMargin.VisualElement.IsVisibleChanged += OnScrollBarIsVisibleChanged;
                    _realScrollBar.TrackSpanChanged += OnScrollBarTrackSpanChanged;
                }
            }
            ResetTrackSpan();

            _scrollMapFactory = scrollMapFactoryService;
            _useElidedCoordinates = false;
            ResetScrollMap();

            _scrollMap.MappingChanged += delegate { RaiseTrackChangedEvent(); };

            container.SizeChanged += OnContainerSizeChanged;
        }
开发者ID:mpartipilo,项目名称:SonarCompanion,代码行数:26,代码来源:SimpleScrollBar.cs

示例11: CreateMargin

        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            IWpfTextView view = textViewHost.TextView;

            // Files larger than 1 MB should be skipped to avoid hangs.
            if (view.TextSnapshot.Length > (1024 * 1024))
                return null;

            ITextDocument document;
            if (!_TextDocumentFactoryService.TryGetTextDocument(view.TextDataModel.DocumentBuffer, out document))
                return null;

            IVsExtensionManager manager = _serviceProvider.GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;
            if (manager == null)
                return null;

            IInstalledExtension extension;
            manager.TryGetInstalledExtension("FixMixedTabs", out extension);
            if (extension != null)
                return null;

            ITextUndoHistory history;
            if (!_UndoHistoryRegistry.TryGetHistory(view.TextBuffer, out history))
            {
                Debug.Fail("Unexpected: couldn't get an undo history for the given text buffer");
                return null;
            }

            return new InformationBarMargin(view, document, _OperationsFactory.GetEditorOperations(view), history);
        }
开发者ID:xornand,项目名称:VS-PPT,代码行数:30,代码来源:MarginFactory.cs

示例12: CreateMargin

        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            string source = textViewHost.TextView.TextBuffer.CurrentSnapshot.GetText();
            ITextDocument document;

            if (TextDocumentFactoryService.TryGetTextDocument(textViewHost.TextView.TextDataModel.DocumentBuffer, out document))
            {
                switch (textViewHost.TextView.TextBuffer.ContentType.DisplayName.ToLowerInvariant())
                {
                    case "less":
                        bool showLess = WESettings.GetBoolean(WESettings.Keys.ShowLessPreviewWindow);
                        return new LessMargin("CSS", source, showLess, document);

                    case "coffeescript":
                        bool showCoffee = WESettings.GetBoolean(WESettings.Keys.ShowCoffeeScriptPreviewWindow);
                        return new CoffeeScriptMargin("JavaScript", source, showCoffee, document);

                    case "markdown":
                        bool showMarkdown = WESettings.GetBoolean(WESettings.Keys.MarkdownShowPreviewWindow);
                        return new MarkdownMargin("text", source, showMarkdown, document);
                }
            }

            return null;
        }
开发者ID:Russe11,项目名称:WebEssentials2013,代码行数:25,代码来源:EditorMarginFactory.cs

示例13: CreateMargin

        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            int iErrStat;

            //_contentTypeRegistryService = ContentTypeRegistryService;
            //_textBufferFactoryService = TextBufferFactoryService;

            //DTE2 dte = (DTE2)serviceProvider.GetService(typeof(DTE));

            //iErrStat = GetHiddenTextManager(serviceProvider);


            //IComponentModel componentModel = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel));
            //IVsEditorAdaptersFactoryService adapterFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>();

            
            ////System.Diagnostics.Trace.WriteLine(":" + _textBufferFactoryService.TextContentType.ToString());
            //_curTextBuf = _textBufferFactoryService.CreateTextBuffer("test", _textBufferFactoryService.PlaintextContentType);

            foreach (IViewTaggerProvider vtp in viewTaggerProviderCollection)
            {
                if (vtp is TextInvisTaggerProvider)
                {
                    _titp = vtp as TextInvisTaggerProvider;
                    break;
                }
            }
            if (_titp == null)
            {
                System.Diagnostics.Trace.WriteLine("no valid tagger, exit");
                return null;
            }
            return new TestMargin(textViewHost.TextView, _titp.GetThyTagger());
        }
开发者ID:mintberry,项目名称:stackrecaller,代码行数:34,代码来源:TestMarginFactory.cs

示例14: PlayMouseProcessor

        public PlayMouseProcessor(IWpfTextViewHost wpfTextViewHost, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
        {
            _wpfTextViewHost = wpfTextViewHost;
            _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;

            _createTagAggregator = _viewTagAggregatorFactoryService.CreateTagAggregator<PlayGlyphTag>(_wpfTextViewHost.TextView);
        }
开发者ID:AngelPortal,项目名称:NBehave,代码行数:7,代码来源:PlayGlyphMouseProcessorProvider.cs

示例15: CreateControls

        protected override void CreateControls(IWpfTextViewHost host, string source)
        {
            int width = WESettings.GetInt(SettingsKey);
            width = width == -1 ? 400 : width;

            _browser = new WebBrowser();
            _browser.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            Grid grid = new Grid();
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0, GridUnitType.Star) });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Pixel) });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(width) });
            grid.RowDefinitions.Add(new RowDefinition());

            grid.Children.Add(_browser);
            this.Children.Add(grid);

            Grid.SetColumn(_browser, 2);
            Grid.SetRow(_browser, 0);

            GridSplitter splitter = new GridSplitter();
            splitter.Width = 5;
            splitter.ResizeDirection = GridResizeDirection.Columns;
            splitter.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            splitter.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            splitter.DragCompleted += splitter_DragCompleted;

            grid.Children.Add(splitter);
            Grid.SetColumn(splitter, 1);
            Grid.SetRow(splitter, 0);
        }
开发者ID:jaredpar,项目名称:WebEssentials2013,代码行数:31,代码来源:SvgMargin.cs


注:本文中的IWpfTextViewHost类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。