• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IWpfTextView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: BottomMargin

        public BottomMargin(IWpfTextView textView, IClassifierAggregatorService classifier, ITextDocumentFactoryService documentService)
        {
            _textView = textView;
            _classifier = classifier.GetClassifier(textView.TextBuffer);
            _foregroundBrush = new SolidColorBrush((Color)FindResource(VsColors.CaptionTextKey));
            _backgroundBrush = new SolidColorBrush((Color)FindResource(VsColors.ScrollBarBackgroundKey));

            this.Background = _backgroundBrush;
            this.ClipToBounds = true;

            _lblEncoding = new TextControl("Encoding");
            this.Children.Add(_lblEncoding);

            _lblContentType = new TextControl("Content type");
            this.Children.Add(_lblContentType);

            _lblClassification = new TextControl("Classification");
            this.Children.Add(_lblClassification);

            _lblSelection = new TextControl("Selection");
            this.Children.Add(_lblSelection);

            UpdateClassificationLabel();
            UpdateContentTypeLabel();
            UpdateContentSelectionLabel();

            if (documentService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _doc))
            {
                _doc.FileActionOccurred += FileChangedOnDisk;
                UpdateEncodingLabel(_doc);
            }

            textView.Caret.PositionChanged += CaretPositionChanged;
        }
开发者ID:modulexcite,项目名称:ExtensibilityTools,代码行数:34,代码来源:BottomMargin.cs


示例2: GochiusaIDE

        /// <summary>
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        public GochiusaIDE(IWpfTextView view)
        {
            _view = view;

            InitImages();

            eyeClosed = false;
            cRandom = new Random();

            building = false;
            buildDone = false;
            clean = false;

            //Grab a reference to the adornment layer that this adornment should be added to
            _adornmentLayer = view.GetAdornmentLayer("GochiusaIDE");
            _adornmentBackgroundLayer = view.GetAdornmentLayer("GochiusaIDE_Background");
            _adornmentBuildLayer = view.GetAdornmentLayer("GochiusaIDE_Build");

            _adornmentBackgroundLayer.AddAdornment(AdornmentPositioningBehavior.ViewportRelative, null, null, _backgroundImage, null);

            faceTimer = new DispatcherTimer(DispatcherPriority.Normal);
            faceTimer.Interval = new TimeSpan(30000000);
            faceTimer.Tick += new EventHandler(faceTimer_Tick);
            faceTimer.Start();

            buildTimer = new DispatcherTimer(DispatcherPriority.Normal);
            buildTimer.Interval = new TimeSpan(5000000);
            buildTimer.Tick += new EventHandler(buildTimer_Tick);
            buildTimer.Start();

            _view.ViewportHeightChanged += delegate { this.onSizeChange(); };
            _view.ViewportWidthChanged += delegate { this.onSizeChange(); };
        }
开发者ID:noradium,项目名称:GochiusaIDE,代码行数:38,代码来源:GochiusaIDE.cs


示例3: EditorDiffMargin

        internal EditorDiffMargin(IWpfTextView textView, UnifiedDiff unifiedDiff, IMarginCore marginCore)
            : base(textView)
        {
            ViewModel = new EditorDiffMarginViewModel(marginCore, unifiedDiff, UpdateDiffDimensions);

            UserControl = new EditorDiffMarginControl {DataContext = ViewModel, Width = MarginWidth};
        }
开发者ID:laurentkempe,项目名称:PReview,代码行数:7,代码来源:EditorDiffMargin.cs


示例4: SubjectBuffersDisconnected

		public void SubjectBuffersDisconnected(IWpfTextView textView, ConnectionReason reason, Collection<ITextBuffer> subjectBuffers) {
			foreach (var buffer in subjectBuffers) {
				foreach (var document in buffer.GetRelatedDocuments()) {
					buffer.GetWorkspace().CloseDocument(document.Id);
				}
			}
		}
开发者ID:SLaks,项目名称:VSEmbed,代码行数:7,代码来源:RoslynBufferListener.cs


示例5: CommandFilter

        public CommandFilter(IWpfTextView textView, ICompletionBroker broker)
        {
            _currentSession = null;

            TextView = textView;
            Broker = broker;
        }
开发者ID:kevinderudder,项目名称:WebEssentials2013,代码行数:7,代码来源:RobotsCompletionController.cs


示例6: GetGraphics

        /// <summary>
        /// Creates a very long line at the bottom of bounds.
        /// </summary>
        public override GraphicsResult GetGraphics(IWpfTextView view, Geometry bounds)
        {
            Initialize(view);

            var border = new Border()
            {
                BorderBrush = _graphicsTagBrush,
                BorderThickness = new Thickness(0, 0, 0, bottom: 1),
                Height = 1,
                Width = view.ViewportWidth
            };
            EventHandler viewportWidthChangedHandler = (s, e) =>
            {
                border.Width = view.ViewportWidth;
            };

            view.ViewportWidthChanged += viewportWidthChangedHandler;

            // Subtract rect.Height to ensure that the line separator is drawn
            // at the bottom of the line, rather than immediately below.
            // This makes the line separator line up with the outlining bracket.
            Canvas.SetTop(border, bounds.Bounds.Bottom - border.Height);

            return new GraphicsResult(border,
                () => view.ViewportWidthChanged -= viewportWidthChangedHandler);
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:29,代码来源:LineSeparatorTag.cs


示例7: RemoveWhitespaceOnSave

 public RemoveWhitespaceOnSave(IVsTextView textViewAdapter, IWpfTextView view, DTE2 dte, ITextDocument document)
 {
     textViewAdapter.AddCommandFilter(this, out _nextCommandTarget);
     _view = view;
     _dte = dte;
     _document = document;
 }
开发者ID:laurentkempe,项目名称:TrailingWhitespace,代码行数:7,代码来源:RemoveWhitespaceOnSave.cs


示例8: EnterFormat

 public EnterFormat(IVsTextView adapter, IWpfTextView textView, IEditorFormatterProvider formatterProvider, ICompletionBroker broker)
     : base(adapter, textView, typeof(Microsoft.VisualStudio.VSConstants.VSStd2KCmdID).GUID, 3)
 {
     _tree = HtmlEditorDocument.FromTextView(textView).HtmlEditorTree;
     _formatter = formatterProvider.CreateRangeFormatter();
     _broker = broker;
 }
开发者ID:ncl-dmoreira,项目名称:WebEssentials2013,代码行数:7,代码来源:EnterFormatCommandTarget.cs


示例9: CaretFisheyeLineTransformSource

        private CaretFisheyeLineTransformSource(IWpfTextView textView)
        {
            _textView = textView;

            //Sync to changing the caret position. 
            _textView.Caret.PositionChanged += OnCaretChanged;
        }
开发者ID:Sunzhuokai,项目名称:VSSDK-Extensibility-Samples,代码行数:7,代码来源:CaretFisheyeLineTransformSource.cs


示例10: InstantVisualStudio

		public InstantVisualStudio (IWpfTextView view, ITextDocumentFactoryService textDocumentFactoryService)
		{
			this.view = view;
			this.layer = view.GetAdornmentLayer("Instant.VisualStudio");

			//Listen to any event that changes the layout (text changes, scrolling, etc)
			this.view.LayoutChanged += OnLayoutChanged;

			this.dispatcher = Dispatcher.CurrentDispatcher;

			this.evaluator.EvaluationCompleted += OnEvaluationCompleted;
			this.evaluator.Start();

			this.dte.Events.BuildEvents.OnBuildProjConfigDone += OnBuildProjeConfigDone;
			this.dte.Events.BuildEvents.OnBuildDone += OnBuildDone;
			this.dte.Events.BuildEvents.OnBuildBegin += OnBuildBegin;

			this.statusbar = (IVsStatusbar)this.serviceProvider.GetService (typeof (IVsStatusbar));

			ITextDocument textDocument;
			if (!textDocumentFactoryService.TryGetTextDocument (view.TextBuffer, out textDocument))
				throw new InvalidOperationException();

			this.document = this.dte.Documents.OfType<EnvDTE.Document>().FirstOrDefault (d => d.FullName == textDocument.FilePath);

			InstantTagToggleAction.Toggled += OnInstantToggled;
		}
开发者ID:ermau,项目名称:Instant,代码行数:27,代码来源:InstantVisualStudio.cs


示例11: Update

        internal void Update(
            string text,
            ITextViewLine line,
            IWpfTextView view,
            TextRunProperties formatting,
            double marginWidth,
            double verticalOffset)
        {
            LineTag = line.IdentityTag;

            if (_text == null || !string.Equals(_text, text, StringComparison.Ordinal))
            {
                _text = text;
                _formattedText = new FormattedText(
                    _text,
                    CultureInfo.InvariantCulture,
                    FlowDirection.LeftToRight,
                    formatting.Typeface,
                    formatting.FontRenderingEmSize,
                    formatting.ForegroundBrush);

                _horizontalOffset = Math.Round(marginWidth - _formattedText.Width);
                InvalidateVisual();
            }

            var num = line.TextTop - view.ViewportTop + verticalOffset;
            // ReSharper disable once CompareOfFloatsByEqualityOperator
            if (num == _verticalOffset) return;
            _verticalOffset = num;
            InvalidateVisual();
        }
开发者ID:kazu46,项目名称:VSColorOutput,代码行数:31,代码来源:TimeStampVisual.cs


示例12: ClaudiaIDE

        /// <summary>
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        /// <param name="imageProvider">The <see cref="IImageProvider"/> which provides bitmaps to draw</param>
        /// <param name="setting">The <see cref="Setting"/> contains user image preferences</param>
        public ClaudiaIDE(IWpfTextView view, List<IImageProvider> imageProvider, Setting setting)
		{
		    try
		    {
		        _dispacher = Dispatcher.CurrentDispatcher;
                _imageProviders = imageProvider;
                _imageProvider = imageProvider.FirstOrDefault(x=>x.ProviderType == setting.ImageBackgroundType);
                _setting = setting;
                if (_imageProvider == null)
                {
                    _imageProvider = new SingleImageProvider(_setting);
                }
                _view = view;
                _image = new Image
                {
                    Opacity = setting.Opacity,
                    IsHitTestVisible = false
                };
                _adornmentLayer = view.GetAdornmentLayer("ClaudiaIDE");
				_view.ViewportHeightChanged += delegate { RepositionImage(); };
				_view.ViewportWidthChanged += delegate { RepositionImage(); };     
                _view.ViewportLeftChanged += delegate { RepositionImage(); };
                _setting.OnChanged += delegate { ReloadSettings(); };

                _imageProviders.ForEach(x => x.NewImageAvaliable += delegate { InvokeChangeImage(); });

                ChangeImage();
            }
			catch
			{
			}
		}
开发者ID:liange,项目名称:ClaudiaIDE,代码行数:39,代码来源:ClaudiaIDE.cs


示例13: InsertText

        private static void InsertText(IWpfTextView view, DTE2 dte, string text)
        {
            try
            {
                dte.UndoContext.Open("Generate text");

                using (var edit = view.TextBuffer.CreateEdit())
                {
                    if (!view.Selection.IsEmpty)
                    {
                        edit.Delete(view.Selection.SelectedSpans[0].Span);
                        view.Selection.Clear();
                    }

                    edit.Insert(view.Caret.Position.BufferPosition, text);
                    edit.Apply();
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
            finally
            {
                dte.UndoContext.Close();
            }
        }
开发者ID:madskristensen,项目名称:TextGenerator,代码行数:27,代码来源:VSPackage.cs


示例14: TextViewCreated

 public void TextViewCreated(IWpfTextView textView)
 {
     IPresentationModeState state = PkgSource.PresentationMode;
       textView.Properties.GetOrCreateSingletonProperty(
     () => new PresentationMode(textView, state, Settings)
       );
 }
开发者ID:bayulabster,项目名称:viasfora,代码行数:7,代码来源:PresentationModeFactory.cs


示例15: DropHandler

 public DropHandler(IWpfTextView wpfTextView, IEnumerable<IDropInfoHandler> dropInfoHandlers, IDropAction dropAction)
 {
     _log.Debug("DropHandler.ctor");
     _tgt = wpfTextView;
     _dropInfoHandlers = dropInfoHandlers;
     _dropAction = dropAction;
 }
开发者ID:stickleprojects,项目名称:VSDropAssist,代码行数:7,代码来源:DropHandler.cs


示例16: TextViewCreated

 public void TextViewCreated(IWpfTextView textView)
 {
   // Add the error list support to the just created view
   textView.TextBuffer.Properties.GetOrCreateSingletonProperty<ErrorListPresenter>(() =>
       new ErrorListPresenter(textView.TextBuffer, _errorProviderFactory, _serviceProviderServiceProvider)
   );
 }
开发者ID:derigel23,项目名称:Nitra,代码行数:7,代码来源:ErrorListPresenterFactory.cs


示例17: BackgroundColorVisualManager

        public BackgroundColorVisualManager(IWpfTextView view, ITagAggregator<IClassificationTag> aggregator, IClassificationFormatMap formatMap,
                                            IVsFontsAndColorsInformationService fcService, IVsEditorAdaptersFactoryService adaptersService)
        {
            _view = view;
            _layer = view.GetAdornmentLayer("BackgroundColorFix");
            _aggregator = aggregator;
            _formatMap = formatMap;

            _fcService = fcService;
            _adaptersService = adaptersService;

            _view.LayoutChanged += OnLayoutChanged;

            // Here are the hacks for making the normal classification background go away:

            _formatMap.ClassificationFormatMappingChanged += (sender, args) =>
                {
                    if (!_inUpdate && _view != null && !_view.IsClosed)
                    {
                        _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap));
                    }
                };

            _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap));
        }
开发者ID:ijprest,项目名称:BackgroundColorFix,代码行数:25,代码来源:BackgroundColorVisualManager.cs


示例18: GetGraphics

        public override GraphicsResult GetGraphics(IWpfTextView view, Geometry geometry)
        {
            Initialize(view);

            // We clip off a bit off the start of the line to prevent a half-square being
            // drawn.
            var clipRectangle = geometry.Bounds;
            clipRectangle.Offset(2, 0);

            var line = new Line
            {
                X1 = geometry.Bounds.Left,
                Y1 = geometry.Bounds.Bottom - _graphicsTagPen.Thickness,
                X2 = geometry.Bounds.Right,
                Y2 = geometry.Bounds.Bottom - _graphicsTagPen.Thickness,
                Clip = new RectangleGeometry { Rect = clipRectangle }
            };
            // RenderOptions.SetEdgeMode(line, EdgeMode.Aliased);

            ApplyPen(line, _graphicsTagPen);

            // Shift the line over to offset the clipping we did.
            line.RenderTransform = new TranslateTransform(-_graphicsTagPen.Thickness, 0);
            return new GraphicsResult(line, null);
        }
开发者ID:TyOverby,项目名称:roslyn,代码行数:25,代码来源:SuggestionTag.cs


示例19: TextViewCreated

 public void TextViewCreated(IWpfTextView textView)
 {
     if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _document))
     {
         _document.FileActionOccurred += document_FileActionOccurred;
     }
 }
开发者ID:Gordon-Beeming,项目名称:WebEssentials2013,代码行数:7,代码来源:IntellisenseParser.cs


示例20: Create

    public ILineTransformSource Create(IWpfTextView textView) {
      Contract.Assume(textView != null);

      if (VSServiceProvider.Current == null || VSServiceProvider.Current.ExtensionHasFailed) {
        //If the VSServiceProvider is not initialize, we can't do anything.
        return null;// new DummyLineTransformSource();
      }

      try {
        VSServiceProvider.Current.ExtensionFailed += OnFailed;

        if (hasFailed) return null;

        Contract.Assume(this.OutliningManagerService != null, "Import attribute guarantees this.");

        var outliningManager = OutliningManagerService.GetOutliningManager(textView);
        if (outliningManager == null)
          return null;//new DummyLineTransformSource();

        var inheritanceManager = AdornmentManager.GetOrCreateAdornmentManager(textView, "InheritanceAdornments", outliningManager, VSServiceProvider.Current.Logger);
        var metadataManager = AdornmentManager.GetOrCreateAdornmentManager(textView, "MetadataAdornments", outliningManager, VSServiceProvider.Current.Logger);

        return new LineTransformSource(VSServiceProvider.Current.Logger, inheritanceManager.Adornments.Values, metadataManager.Adornments.Values);
      } catch (Exception exn) {
        VSServiceProvider.Current.Logger.PublicEntryException(exn, "Create");
        return null;// new DummyLineTransformSource();
      }
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:28,代码来源:LineTransformer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IWpfTextViewHost类代码示例发布时间:2022-05-24
下一篇:
C# IWorld类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap