/// <summary>
		/// Jumps to the definition referred to by the <see cref="ReferenceSegment"/>.
		/// </summary>
		internal void JumpToReference(ReferenceSegment referenceSegment)
		{
			object reference = referenceSegment.Reference;
			if (referenceSegment.IsLocal) {
				ClearLocalReferenceMarks();
				if (references != null) {
					foreach (var r in references) {
						if (reference.Equals(r.Reference)) {
							var mark = textMarkerService.Create(r.StartOffset, r.Length);
							mark.BackgroundColor = r.IsLocalTarget ? Colors.LightSeaGreen : Colors.GreenYellow;
							localReferenceMarks.Add(mark);
						}
					}
				}
				return;
			}
			if (definitionLookup != null) {
				int pos = definitionLookup.GetDefinitionPosition(reference);
				if (pos >= 0) {
					textEditor.TextArea.Focus();
					textEditor.Select(pos, 0);
					textEditor.ScrollTo(textEditor.TextArea.Caret.Line, textEditor.TextArea.Caret.Column);
					Dispatcher.Invoke(DispatcherPriority.Background, new Action(
						delegate {
							CaretHighlightAdorner.DisplayCaretHighlightAnimation(textEditor.TextArea);
						}));
					return;
				}
			}
			MainWindow.Instance.JumpToReference(reference);
		}
		public static void DisplayCaretHighlightAnimation(TextArea textArea) {
			AdornerLayer layer = AdornerLayer.GetAdornerLayer(textArea.TextView);
			CaretHighlightAdorner adorner = new CaretHighlightAdorner(textArea);
			layer.Add(adorner);

			DispatcherTimer timer = new DispatcherTimer();
			timer.Interval = TimeSpan.FromSeconds(1);
			timer.Tick += delegate {
				timer.Stop();
				layer.Remove(adorner);
			};
			timer.Start();
		}
Exemple #3
0
        public static void DisplayCaretHighlightAnimation(TextArea textArea)
        {
            AdornerLayer          layer   = AdornerLayer.GetAdornerLayer(textArea.TextView);
            CaretHighlightAdorner adorner = new CaretHighlightAdorner(textArea);

            layer.Add(adorner);

            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += delegate {
                timer.Stop();
                layer.Remove(adorner);
            };
            timer.Start();
        }
        /// <summary>
        /// Jumps to the definition referred to by the <see cref="ReferenceSegment"/>.
        /// </summary>
        internal void JumpToReference(ReferenceSegment referenceSegment)
        {
            object reference = referenceSegment.Reference;

            if (definitionLookup != null)
            {
                int pos = definitionLookup.GetDefinitionPosition(reference);
                if (pos >= 0)
                {
                    textEditor.TextArea.Focus();
                    textEditor.Select(pos, 0);
                    textEditor.ScrollTo(textEditor.TextArea.Caret.Line, textEditor.TextArea.Caret.Column);
                    Dispatcher.Invoke(DispatcherPriority.Background, new Action(
                                          delegate {
                        CaretHighlightAdorner.DisplayCaretHighlightAnimation(textEditor.TextArea);
                    }));
                    return;
                }
            }
            MainWindow.Instance.JumpToReference(reference);
        }