public ToolTipPresenter(
     IViewElementFactoryService viewElementFactoryService,
     ITextView textView,
     ToolTipParameters toolTipParameters)
 {
     this._viewElementFactoryService = viewElementFactoryService ?? throw new ArgumentNullException(nameof(viewElementFactoryService));
     this.textView          = textView ?? throw new ArgumentNullException(nameof(textView));
     this.toolTipParameters = toolTipParameters ?? throw new ArgumentNullException(nameof(toolTipParameters));
 }
Example #2
0
 public MouseTrackingWpfToolTipPresenter(
     IViewElementFactoryService viewElementFactoryService,
     IObscuringTipManager obscuringTipManager,
     ITextView textView,
     ToolTipParameters parameters,
     ToolTipPresenterStyle presenterStyle)
     : base(viewElementFactoryService, obscuringTipManager, textView, parameters, presenterStyle)
 {
 }
Example #3
0
 public BaseWpfToolTipPresenter(
     IViewElementFactoryService viewElementFactoryService,
     IObscuringTipManager obscuringTipManager,
     ITextView textView,
     ToolTipParameters parameters,
     ToolTipPresenterStyle presenterStyle)
 {
     this.viewElementFactoryService = viewElementFactoryService
                                      ?? throw new ArgumentNullException(nameof(viewElementFactoryService));
     this.obscuringTipManager = obscuringTipManager
                                ?? throw new ArgumentNullException(nameof(obscuringTipManager));
     this.textView       = textView ?? throw new ArgumentNullException(nameof(textView));
     this.parameters     = parameters ?? throw new ArgumentNullException(nameof(parameters));
     this.presenterStyle = presenterStyle ?? throw new ArgumentNullException(nameof(presenterStyle));
 }
Example #4
0
 public IToolTipPresenter Create(ITextView textView, ToolTipParameters parameters)
 {
     if (parameters.TrackMouse)
     {
         return(new MouseTrackingWpfToolTipPresenter(
                    this.viewElementFactoryService,
                    this.obscuringTipManager,
                    textView,
                    parameters,
                    this.styleFactory.Style));
     }
     else
     {
         return(new SpanTrackingWpfToolTipPresenter(
                    this.viewElementFactoryService,
                    this.obscuringTipManager,
                    textView,
                    parameters,
                    this.styleFactory.Style));
     }
 }
Example #5
0
        public IToolTipPresenter CreatePresenter(ITextView textView, ToolTipParameters parameters)
        {
            if (!this.joinableTaskContext.IsOnMainThread)
            {
                throw new InvalidOperationException("Must be called from UI thread");
            }

            foreach (var provider in this.OrderedPresenterProviders)
            {
                var presenter = this.guardedOperations.CallExtensionPoint(
                    () => provider.Value.Create(textView, parameters ?? ToolTipParameters.Default),
                    valueOnThrow: null);

                if (presenter != null)
                {
                    // Wrap in a presenter that wraps all calls in a guarded operation.
                    return(new GuardedToolTipPresenter(this.guardedOperations, presenter));
                }
            }

            throw new InvalidOperationException($"No applicable {nameof(IToolTipPresenterFactory)}");
        }
Example #6
0
        private void CreateAndStartPresenter()
        {
            IntellisenseUtilities.ThrowIfNotOnMainThread(this.joinableTaskContext);
            Debug.Assert(this.uiThreadOnlyPresenter == null);

            // Configure presenter behavior.
            var parameters = new ToolTipParameters(
                this.Options.HasFlag(QuickInfoSessionOptions.TrackMouse),
                keepOpenFunc: this.ContentRequestsKeepOpen);

            // Create and show presenter.
            this.uiThreadOnlyPresenter            = this.toolTipService.CreatePresenter(this.TextView, parameters);
            this.uiThreadOnlyPresenter.Dismissed += this.OnDismissed;
            this.uiThreadOnlyPresenter.StartOrUpdate(this.ApplicableToSpan, this.Content);

            // Ensure that the presenter didn't dismiss the session.
            if (this.State != QuickInfoSessionState.Dismissed)
            {
                // Update state and alert subscribers on the UI thread.
                this.TransitionTo(QuickInfoSessionState.Visible);
            }
        }
Example #7
0
 public IToolTipPresenter CreatePresenter(ITextView textView, ToolTipParameters parameters = null)
 {
     return(new MockToolTipPresenter());
 }
 public MouseTrackToolTipPresenter(
     IViewElementFactoryService viewElementFactoryService, ITextView textView, ToolTipParameters toolTipParameters) :
     base(viewElementFactoryService, textView, toolTipParameters)
 {
 }