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


C# IWpfTextView.GetAdornmentLayer方法代码示例

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


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

示例1: AchievementAdornments

        public AchievementAdornments(IWpfTextView view)
        {
            this.view = view;
            this.layer = view.GetAdornmentLayer("AchievementAdornments");
            this.descriptionLayer = view.GetAdornmentLayer("AchievementAdornmentsDescription");

            view.LayoutChanged += OnLayoutChanged;

            Brush brush = new SolidColorBrush(Color.FromArgb(0x20, 0x00, 0x00, 0xff));
            brush.Freeze();

            Brush penBrush = new SolidColorBrush(Colors.Red);
            penBrush.Freeze();

            Pen pen = new Pen(penBrush, 0.5);
            pen.Freeze();

            this.brush = brush;
            this.pen = pen;

            AchievementUIContext.AchievementClicked += (sender, e) =>
            {
                Reset();

                var filePath = GetFilePath(view);
                if (e.AchievementDescriptor.CodeOrigin.FileName != filePath)
                    return;

                codeOrigin = e.AchievementDescriptor.CodeOrigin;
                achievementUiElement = (UIElement)e.UIElement;

                CreateAdornment();
            };
        }
开发者ID:clausjoergensen,项目名称:strokes,代码行数:34,代码来源:AchievementAdornments.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: ViewportAdornment1

        /// <summary>
        /// Inizializza una nuova istanza della classe ViewportAdornment1 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="theView">
        /// Puntatore alla vista di Visual Studio da Factory.
        /// </param>
        public ViewportAdornment1(IWpfTextView theView)
        {
            view = theView;

            // Brush brush = new SolidColorBrush(Color.FromArgb(0x20, 0x00, 0x00, 0xff));
            // brush.Freeze();

            // Brush penBrush = new SolidColorBrush(Colors.Red);
            // penBrush.Freeze();
            // Pen pen = new Pen(penBrush, 0.5);
            // pen.Freeze();

            //// draw a square with the created brush and pen
            // System.Windows.Rect r = new System.Windows.Rect(0, 0, 5, 5);
            // Geometry g = new RectangleGeometry(r);
            // GeometryDrawing drawing = new GeometryDrawing(brush, pen, g);
            // drawing.Freeze();

            // image = new DrawingImage(drawing);
            // image.Freeze();
            SetColor();

            // Grab a reference to the adornment layer that this adornment should be added to
            adornmentLayer = view.GetAdornmentLayer("ViewportAdornment1");

            view.ViewportHeightChanged += delegate { OnSizeChange(); };
            view.ViewportWidthChanged += delegate { OnSizeChange(); };
        }
开发者ID:AlmatoolboxCE,项目名称:AlmaStyleFix,代码行数:35,代码来源:ViewportAdornment1.cs

示例4: TranslationAdornment

        /// <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 TranslationAdornment(IWpfTextView view)
        {
            _view = view;

            Brush brush = new SolidColorBrush(Colors.BlueViolet);
            brush.Freeze();
            Brush penBrush = new SolidColorBrush(Colors.Red);
            penBrush.Freeze();
            Pen pen = new Pen(penBrush, 0.5);
            pen.Freeze();

            //draw a square with the created brush and pen
            System.Windows.Rect r = new System.Windows.Rect(0, 0, 30, 30);
            Geometry g = new RectangleGeometry(r);
            GeometryDrawing drawing = new GeometryDrawing(brush, pen, g);
            drawing.Freeze();

            DrawingImage drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            _image = new Image();
            _image.Source = drawingImage;

            //Grab a reference to the adornment layer that this adornment should be added to
            _adornmentLayer = view.GetAdornmentLayer("TranslationAdornment");

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

示例5: CodeAdornment

        public CodeAdornment(IWpfTextView view)
        {
            _view = view;
            _sourceFilePath = GetSourceFilePath();
            _adornmentLayer = view.GetAdornmentLayer("CodeAdornment");

            _adornmentLayer.RemoveAllAdornments();
            containingUnitView = ContainingUnitView.GetContainingUnitViewByName(_sourceFilePath);

            if (containingUnitView.Parent != null)
            {
                var adornmentLayer = (IAdornmentLayer)containingUnitView.Parent;
                adornmentLayer.RemoveAdornment(containingUnitView);
            }

            //TODO Some how anchor the adornment layer to prevent random moving.
            Canvas.SetTop(containingUnitView, 0);
            _adornmentLayer.AddAdornment(AdornmentPositioningBehavior.OwnerControlled, null, null, containingUnitView, null);

            // _view.ViewportWidthChanged += delegate { Initialize(); };
            //_view.ViewportHeightChanged += delegate { Initialize(); };
            //    _view.LayoutChanged += delegate { Initialize(); };
            //   _view.ViewportLeftChanged += delegate { Initialize(); };
            //   _view.ZoomLevelChanged += delegate { Initialize(); };
            // _view.VisualElement.SizeChanged +=delegate { Initialize(); };
        }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:26,代码来源:CodeAdornment.cs

示例6: ErrorHighlighter

        public ErrorHighlighter(IWpfTextView view, ITextDocument document, IVsTaskList tasks, DTE2 dte)
        {
            _view = view;
            _document = document;
            _text = new Adornment();
            _tasks = tasks;
            _dispatcher = Dispatcher.CurrentDispatcher;

            _adornmentLayer = view.GetAdornmentLayer(ErrorHighlighterFactory.LayerName);

            _view.ViewportHeightChanged += SetAdornmentLocation;
            _view.ViewportWidthChanged += SetAdornmentLocation;

            _text.MouseUp += (s, e) => { dte.ExecuteCommand("View.ErrorList"); };

            _timer = new Timer(750);
            _timer.Elapsed += (s, e) =>
            {
                _timer.Stop();
                Task.Run(() =>
                {
                    _dispatcher.Invoke(new Action(() =>
                    {
                        Update(false);
                    }), DispatcherPriority.ApplicationIdle, null);
                });
            };
            _timer.Start();
        }
开发者ID:vandro,项目名称:ErrorHighlighter,代码行数:29,代码来源:ErrorHighlighter.cs

示例7: CurrentColumnAdornment

        public CurrentColumnAdornment(
            IWpfTextView view, IClassificationFormatMap formatMap,
            IClassificationType formatType, IVsfSettings settings)
        {
            this.view = view;
              this.formatMap = formatMap;
              this.formatType = formatType;
              this.settings = settings;
              this.columnRect = new Rectangle();
              layer = view.GetAdornmentLayer(Constants.COLUMN_HIGHLIGHT);

              view.Caret.PositionChanged += OnCaretPositionChanged;
              view.ViewportWidthChanged += OnViewportChanged;
              view.ViewportHeightChanged += OnViewportChanged;
              view.LayoutChanged += OnViewLayoutChanged;
              view.TextViewModel.EditBuffer.PostChanged += OnBufferPostChanged;
              view.Closed += OnViewClosed;
              view.Options.OptionChanged += OnSettingsChanged;

              this.settings.SettingsChanged += OnSettingsChanged;
              formatMap.ClassificationFormatMappingChanged +=
             OnClassificationFormatMappingChanged;

              CreateDrawingObjects();
        }
开发者ID:bayulabster,项目名称:viasfora,代码行数:25,代码来源:CurrentColumnAdornment.cs

示例8: ImageAdornmentManager

        internal ImageAdornmentManager(IServiceProvider serviceProvider, IWpfTextView view, IEditorFormatMap editorFormatMap)
        {
            View = view;
            this.serviceProvider = serviceProvider;
            AdornmentLayer = View.GetAdornmentLayer(ImageAdornmentLayerName);

            ImagesAdornmentsRepository = new ImageAdornmentRepositoryService(view.TextBuffer);

            // Create the highlight line adornment
            HighlightLineAdornment = new HighlightLineAdornment(view, editorFormatMap);
            AdornmentLayer.AddAdornment(AdornmentPositioningBehavior.OwnerControlled, null, HighlightLineAdornment,
                                        HighlightLineAdornment.VisualElement, null);

            // Create the preview image adornment
            PreviewImageAdornment = new PreviewImageAdornment();
            AdornmentLayer.AddAdornment(AdornmentPositioningBehavior.OwnerControlled, null, this,
                                        PreviewImageAdornment.VisualElement, null);

            // Attach to the view events
            View.LayoutChanged += OnLayoutChanged;
            View.TextBuffer.Changed += OnBufferChanged;
            View.Closed += OnViewClosed;

            // Load and initialize the image adornments repository
            ImagesAdornmentsRepository.Load();
            ImagesAdornmentsRepository.Images.ToList().ForEach(image => InitializeImageAdornment(image));
        }
开发者ID:dangilkerson,项目名称:ApprovalTestsVS2010,代码行数:27,代码来源:ImageAdornmentManager.cs

示例9: LyricalEditor

        /// <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 LyricalEditor(IWpfTextView view, IEnumerable<Detail> details)
        {
            this.view = view;
            var doc =
                view.TextDataModel.DocumentBuffer.Properties.GetProperty<ITextDocument>(typeof(ITextDocument));
            var file = doc.FilePath;

            detail = details.FirstOrDefault(d => Regex.IsMatch(file, d.RuleRegex));
            imageFile = SelectFile(detail, 0);

            //Grab a reference to the adornment layer that this adornment should be added to
            this.adornmentLayer = view.GetAdornmentLayer("LyricalEditor");

            view.ViewportHeightChanged += delegate { this.onSizeChange(); };
            view.ViewportWidthChanged += delegate { this.onSizeChange(); };

            if (detail.IsSlideShow)
            {
                timer.Interval = TimeSpan.FromSeconds((double)detail.SlideShowTiming);
                timer.Tick += delegate
                {
                    crntImageIndex++;
                    if (crntImageIndex >= detail.Images.Count)
                        crntImageIndex = 0;
                    imageFile = SelectFile(detail, crntImageIndex);
                    SetImage();
                };
                timer.Start();
            }
            view.Closed += delegate { timer.Stop(); };
            view.GotAggregateFocus += delegate { if (detail.IsSlideShow) timer.Start(); };
            view.LostAggregateFocus += delegate { if (detail.IsSlideShow) timer.Stop(); };
        }
开发者ID:bleis-tift,项目名称:LyricalEditor,代码行数:38,代码来源:LyricalEditor.cs

示例10: 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

示例11: 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

示例12: MiddleClickScroll

 private MiddleClickScroll(IWpfTextView view, MiddleClickScrollFactory factory)
 {
     this._view = view;
     this._layer = view.GetAdornmentLayer("MiddleClickScrollLayer");
     this._view.Closed += new EventHandler(this.OnClosed);
     this._view.VisualElement.IsVisibleChanged += new DependencyPropertyChangedEventHandler(this.OnIsVisibleChanged);
 }
开发者ID:gramcha,项目名称:XFeatures,代码行数:7,代码来源:MiddleClickScroll.cs

示例13: 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

示例14: RoslynCodeAnalysisHelper

        public RoslynCodeAnalysisHelper(IWpfTextView view, ITextDocument document, IVsTaskList tasks, DTE2 dte, SVsServiceProvider serviceProvider, IVsActivityLog log)
        {
            _view = view;
            _document = document;
            _text = new Adornment();
            _tasks = tasks;
            _serviceProvider = serviceProvider;
            _log = log;
            _dispatcher = Dispatcher.CurrentDispatcher;

            _adornmentLayer = view.GetAdornmentLayer(RoslynCodeAnalysisFactory.LayerName);

            _view.ViewportHeightChanged += SetAdornmentLocation;
            _view.ViewportWidthChanged += SetAdornmentLocation;

            _text.MouseUp += (s, e) => dte.ExecuteCommand("View.ErrorList");

            _timer = new Timer(750);
            _timer.Elapsed += (s, e) =>
            {
                _timer.Stop();
                System.Threading.Tasks.Task.Run(() =>
                {
                    _dispatcher.Invoke(new Action(() => Update(false)), DispatcherPriority.ApplicationIdle, null);
                });
            };
            _timer.Start();
        }
开发者ID:karthik25,项目名称:roslyn-code-analysis-extension,代码行数:28,代码来源:RoslynCodeAnalysisHelper.cs

示例15: Dashboard

        public Dashboard(
            DashboardViewModel model,
            IWpfTextView textView)
        {
            _model = model;
            InitializeComponent();

            _tabNavigableChildren = new UIElement[] { this.OverloadsCheckbox, this.CommentsCheckbox, this.StringsCheckbox, this.PreviewChangesCheckbox, this.ApplyButton, this.CloseButton }.ToList();

            _textView = textView;
            this.DataContext = model;

            this.Visibility = textView.HasAggregateFocus ? Visibility.Visible : Visibility.Collapsed;

            _textView.GotAggregateFocus += OnTextViewGotAggregateFocus;
            _textView.LostAggregateFocus += OnTextViewLostAggregateFocus;
            _textView.VisualElement.SizeChanged += OnElementSizeChanged;
            this.SizeChanged += OnElementSizeChanged;

            PresentationSource.AddSourceChangedHandler(this, OnPresentationSourceChanged);

            try
            {
                _findAdornmentLayer = textView.GetAdornmentLayer("FindUIAdornmentLayer");
                ((UIElement)_findAdornmentLayer).LayoutUpdated += FindAdornmentCanvas_LayoutUpdated;
            }
            catch (ArgumentOutOfRangeException)
            {
                // Find UI doesn't exist in ETA.
            }

            this.Focus();
            textView.Caret.IsHidden = false;
            ShouldReceiveKeyboardNavigation = false;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:35,代码来源:Dashboard.xaml.cs


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