/// <summary>
 /// Clear tooptip by clearing <seealso cref="ActiveTagData"/> and  refreshing the taggers.
 /// </summary>
 public void ClearTooltip()
 {
     ActiveTagData.ResetCurrent();
     if (_isTooltipShown)
     {
         SendTagsChangedEvent();
     }
 }
コード例 #2
0
 /// <summary>
 /// Set the data members in a batch.
 /// for parameter definition, <seealso cref="ActiveTagData"/> data members.
 /// </summary>
 public static void SetCurrent(IWpfTextView view, long line, UserControl control, string method = null)
 {
     Current = new ActiveTagData()
     {
         TextView       = view,
         SourceLine     = line,
         TooltipControl = control,
         MethodName     = method
     };
 }
        private void OnLostAggregateFocus(object sender, EventArgs e)
        {
            if (_isTooltipShown)
            {
                if (ActiveTagData.Current?.TextView == _view)
                {
                    ActiveTagData.ResetCurrent();
                }

                SendTagsChangedEvent();
            }
        }
コード例 #4
0
        private void DisplayTooltip(SnapshotSpan span)
        {
            _toolTipProvider.ClearToolTip();
            _isTooltipShown = true;
            // Note, keep a local copy of ActiveTagData.Current.
            // In case ActiveTagData.Current changes by other thread or by async re-entrancy.
            ActiveTagData activeData = ActiveTagData.Current;

            if (activeData == null)
            {
                Debug.WriteLine($"{nameof(ActiveTagData.Current)} is empty, this is probably a code bug.");
                return;
            }
            activeData.TooltipControl.Width = _view.ViewportWidth;
            _toolTipProvider.ShowToolTip(
                span.Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeExclusive),
                activeData.TooltipControl,
                PopupStyles.PositionClosest);
        }
コード例 #5
0
        /// <summary>
        /// Show the Logger method tooltip.
        /// </summary>
        /// <param name="logItem">The <seealso cref="LogItem"/> that has the source line information.</param>
        /// <param name="window">The Visual Studio doucment window of the source file.</param>
        public static void ShowToolTip(this LogItem logItem, Window window)
        {
            GotoLine(window, (int)logItem.SourceLine);
            IVsTextView textView = GetIVsTextView(window.Document.FullName);
            var         wpfView  = GetWpfTextView(textView);

            if (wpfView == null)
            {
                return;
            }
            var control = new LoggerTooltipControl();

            control.DataContext = new LoggerTooltipViewModel(logItem);
            ActiveTagData.SetCurrent(
                wpfView,
                logItem.SourceLine.Value,
                control,
                logItem.LogLevel.GetLoggerMethodName());
            TryFindTagger(wpfView)?.ShowOrUpdateToolTip();
        }
        private void DisplayTooltip(SnapshotSpan span)
        {
            _toolTipProvider.Dismiss();
            _isTooltipShown = true;
            // Note, keep a local copy of ActiveTagData.Current.
            // In case ActiveTagData.Current changes by other thread or by async re-entrancy.
            ActiveTagData activeData = ActiveTagData.Current;

            if (activeData == null)
            {
                Debug.WriteLine($"{nameof(ActiveTagData.Current)} is empty, this is probably a code bug.");
                return;
            }
            List <object> uiList = new List <object>();

            uiList.Add(activeData.TextView);
            activeData.TooltipControl.Width = _view.ViewportWidth;
            _toolTipProvider.StartOrUpdate(
                span.Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeExclusive),
                uiList);
        }
コード例 #7
0
        /// <summary>
        /// Show the tooltip for an error group stack frame.
        /// </summary>
        /// <param name="errorGroupItem">The error group item that will be shown in the source code tooltip.</param>
        /// <param name="stackFrame">The stack frame that contains the source file and source line number.</param>
        /// <param name="window">The Visual Studio Document window that opens the source file.</param>
        public static void ShowToolTip(
            ErrorGroupItem errorGroupItem,
            ErrorReporting.StackFrame stackFrame,
            Window window)
        {
            GotoLine(window, (int)stackFrame.LineNumber);
            IVsTextView textView = GetIVsTextView(window.Document.FullName);
            var         wpfView  = GetWpfTextView(textView);

            if (wpfView == null)
            {
                return;
            }
            var control = new ErrorFrameTooltipControl();

            control.DataContext = new ErrorFrameTooltipViewModel(errorGroupItem);
            ActiveTagData.SetCurrent(
                wpfView,
                stackFrame.LineNumber,
                control,
                "");
            TryFindTagger(wpfView)?.ShowOrUpdateToolTip();
        }
コード例 #8
0
 /// <summary>
 /// Set all data members to null.
 /// </summary>
 public static void ResetCurrent()
 {
     Current = null;
 }