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


C# ITextEditorFactoryService.CreateTextViewRoleSet方法代码示例

本文整理汇总了C#中ITextEditorFactoryService.CreateTextViewRoleSet方法的典型用法代码示例。如果您正苦于以下问题:C# ITextEditorFactoryService.CreateTextViewRoleSet方法的具体用法?C# ITextEditorFactoryService.CreateTextViewRoleSet怎么用?C# ITextEditorFactoryService.CreateTextViewRoleSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITextEditorFactoryService的用法示例。


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

示例1: CreateShrunkenTextView

        internal static IWpfTextView CreateShrunkenTextView(
            ITextEditorFactoryService textEditorFactoryService,
            ITextBuffer finalBuffer)
        {
            var roles = textEditorFactoryService.CreateTextViewRoleSet(OutliningRegionTextViewRole);
            var view = textEditorFactoryService.CreateTextView(finalBuffer, roles);

            view.Background = Brushes.Transparent;

            view.SizeToFit();

            // Zoom out a bit to shrink the text.
            view.ZoomLevel *= 0.75;

            return view;
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:16,代码来源:RoslynOutliningRegionTag.cs

示例2: CreateTextView

 private static IWpfTextView CreateTextView(ITextBuffer historyTextBuffer, ITextEditorFactoryService textEditorFactory) {
     var textView = textEditorFactory.CreateTextView(historyTextBuffer, textEditorFactory.DefaultRoles.UnionWith(textEditorFactory.CreateTextViewRoleSet(TextViewRole)));
     textView.Options.SetOptionValue(DefaultTextViewHostOptions.VerticalScrollBarId, true);
     textView.Options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, true);
     textView.Options.SetOptionValue(DefaultTextViewHostOptions.SelectionMarginId, false);
     textView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
     textView.Options.SetOptionValue(DefaultTextViewHostOptions.ZoomControlId, false);
     textView.Options.SetOptionValue(DefaultWpfViewOptions.EnableMouseWheelZoomId, false);
     textView.Options.SetOptionValue(DefaultWpfViewOptions.EnableHighlightCurrentLineId, false);
     textView.Options.SetOptionValue(DefaultTextViewOptions.AutoScrollId, true);
     textView.Options.SetOptionValue(DefaultTextViewOptions.BraceCompletionEnabledOptionId, false);
     textView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
     textView.Options.SetOptionValue(DefaultTextViewOptions.UseVirtualSpaceId, false);
     textView.Caret.IsHidden = true;
     return textView;
 }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:16,代码来源:RHistoryWindowVisualComponent.cs

示例3: PreviewFactoryService

        public PreviewFactoryService(
            ITextBufferFactoryService textBufferFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            ITextDifferencingSelectorService differenceSelectorService,
            IDifferenceBufferFactoryService differenceBufferService,
            IWpfDifferenceViewerFactoryService differenceViewerService)
        {
            _textBufferFactoryService = textBufferFactoryService;
            _contentTypeRegistryService = contentTypeRegistryService;
            _projectionBufferFactoryService = projectionBufferFactoryService;
            _editorOptionsFactoryService = editorOptionsFactoryService;
            _differenceSelectorService = differenceSelectorService;
            _differenceBufferService = differenceBufferService;
            _differenceViewerService = differenceViewerService;

            _previewRoleSet = textEditorFactoryService.CreateTextViewRoleSet(
                TextViewRoles.PreviewRole, PredefinedTextViewRoles.Analyzable);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:21,代码来源:PreviewFactoryService.cs

示例4: InteractiveWindow

        public InteractiveWindow(
            IInteractiveWindowEditorFactoryService host,
            IContentTypeRegistryService contentTypeRegistry,
            ITextBufferFactoryService bufferFactory,
            IProjectionBufferFactoryService projectionBufferFactory,
            IEditorOperationsFactoryService editorOperationsFactory,
            ITextEditorFactoryService editorFactory,
            IIntellisenseSessionStackMapService intellisenseSessionStackMap,
            ISmartIndentationService smartIndenterService,
            IInteractiveEvaluator evaluator)
        {
            if (evaluator == null)
            {
                throw new ArgumentNullException(nameof(evaluator));
            }

            _dangerous_uiOnly = new UIThreadOnly(this, host);

            this.Properties = new PropertyCollection();
            _history = new History();

            _intellisenseSessionStackMap = intellisenseSessionStackMap;
            _smartIndenterService = smartIndenterService;

            var textContentType = contentTypeRegistry.GetContentType("text");
            var replContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName);
            var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName);

            _outputBuffer = bufferFactory.CreateTextBuffer(replOutputContentType);
            _standardInputBuffer = bufferFactory.CreateTextBuffer();

            var projBuffer = projectionBufferFactory.CreateProjectionBuffer(
                new EditResolver(this),
                Array.Empty<object>(),
                ProjectionBufferOptions.None,
                replContentType);

            // we need to set IReplPromptProvider property before TextViewHost is instantiated so that ReplPromptTaggerProvider can bind to it 
            projBuffer.Properties.AddProperty(typeof(InteractiveWindow), this);

            _projectionBuffer = projBuffer;
            _dangerous_uiOnly.AppendNewOutputProjectionBuffer(); // Constructor runs on UI thread.
            projBuffer.Changed += new EventHandler<TextContentChangedEventArgs>(ProjectionBufferChanged);

            var roleSet = editorFactory.CreateTextViewRoleSet(
                PredefinedTextViewRoles.Analyzable,
                PredefinedTextViewRoles.Editable,
                PredefinedTextViewRoles.Interactive,
                PredefinedTextViewRoles.Zoomable,
                PredefinedInteractiveTextViewRoles.InteractiveTextViewRole);

            _textView = host.CreateTextView(this, projBuffer, roleSet);

            _textView.Caret.PositionChanged += CaretPositionChanged;

            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, false);
            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false);
            _textView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
            _textView.Options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStyles.WordWrap);

            _lineBreakString = _textView.Options.GetNewLineCharacter();
            _dangerous_uiOnly.EditorOperations = editorOperationsFactory.GetEditorOperations(_textView); // Constructor runs on UI thread.

            _buffer = new OutputBuffer(this);
            _outputWriter = new InteractiveWindowWriter(this, spans: null);

            SortedSpans errorSpans = new SortedSpans();
            _errorOutputWriter = new InteractiveWindowWriter(this, errorSpans);
            OutputClassifierProvider.AttachToBuffer(_outputBuffer, errorSpans);

            RequiresUIThread();
            evaluator.CurrentWindow = this;
            _evaluator = evaluator;
        }
开发者ID:ahmedshuhel,项目名称:roslyn,代码行数:75,代码来源:InteractiveWindow_UIThread.cs

示例5: UIThreadOnly

            public UIThreadOnly(
                InteractiveWindow window,
                IInteractiveWindowEditorFactoryService factory,
                IContentTypeRegistryService contentTypeRegistry,
                ITextBufferFactoryService bufferFactory,
                IProjectionBufferFactoryService projectionBufferFactory,
                IEditorOperationsFactoryService editorOperationsFactory,
                ITextEditorFactoryService editorFactory,
                IRtfBuilderService rtfBuilderService,
                IIntellisenseSessionStackMapService intellisenseSessionStackMap,
                ISmartIndentationService smartIndenterService,
                IInteractiveEvaluator evaluator,
                IWaitIndicator waitIndicator)
            {
                _window = window;
                _factory = factory;
                _rtfBuilderService = (IRtfBuilderService2)rtfBuilderService;
                _intellisenseSessionStackMap = intellisenseSessionStackMap;
                _smartIndenterService = smartIndenterService;
                _waitIndicator = waitIndicator;
                Evaluator = evaluator;

                var replContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName);
                var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName);

                OutputBuffer = bufferFactory.CreateTextBuffer(replOutputContentType);
                StandardInputBuffer = bufferFactory.CreateTextBuffer();
                _inertType = bufferFactory.InertContentType;

                _projectionBuffer = projectionBufferFactory.CreateProjectionBuffer(
                    new EditResolver(window),
                    Array.Empty<object>(),
                    ProjectionBufferOptions.None,
                    replContentType);

                _projectionBuffer.Properties.AddProperty(typeof(InteractiveWindow), window);

                AppendNewOutputProjectionBuffer();
                _projectionBuffer.Changed += new EventHandler<TextContentChangedEventArgs>(ProjectionBufferChanged);

                var roleSet = editorFactory.CreateTextViewRoleSet(
                    PredefinedTextViewRoles.Analyzable,
                    PredefinedTextViewRoles.Editable,
                    PredefinedTextViewRoles.Interactive,
                    PredefinedTextViewRoles.Zoomable,
                    PredefinedInteractiveTextViewRoles.InteractiveTextViewRole);

                TextView = factory.CreateTextView(window, _projectionBuffer, roleSet);
                TextView.Caret.PositionChanged += CaretPositionChanged;

                var options = TextView.Options;
                options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, true);
                options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
                options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false);
                options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
                options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStyles.None);

                _lineBreakString = options.GetNewLineCharacter();
                EditorOperations = editorOperationsFactory.GetEditorOperations(TextView);

                _buffer = new OutputBuffer(window);
                OutputWriter = new InteractiveWindowWriter(window, spans: null);

                SortedSpans errorSpans = new SortedSpans();
                ErrorOutputWriter = new InteractiveWindowWriter(window, errorSpans);
                OutputClassifierProvider.AttachToBuffer(OutputBuffer, errorSpans);
            }
开发者ID:nileshjagtap,项目名称:roslyn,代码行数:67,代码来源:InteractiveWindow.UIThreadOnly.cs


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