Show / Hide Table of Contents

Class TooltipProvider

The one-stop shop for asynchronous tooltips. This class takes a tooltip hint and through the static GetTooltip method converts it into a tooltip. The underlying tooltip providers are dynamically loaded plugins.

Due to the possibility of fairly expensive operations behind the tooltip, this system SHOULD NOT be used to mass-produce tooltips in some tight loop. Call the tooltip provider only when you know that the user actually needs a tooltip here and now.
Inheritance
object
TooltipProvider
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.Tooltips
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public static class TooltipProvider
Remarks

Tooltip plugin providers must implement the ITooltipProviderPlugin interface, and are welcome to use the TooltipPluginBase base class as well.

A trivial tooltip example:
string myTooltip = TooltipProvider.GetTooltip("{contact_id=" + myContactId + "}");

Methods

GetTooltipAsync(string, CancellationToken)

Process the incoming hint, and return a tooltip. The tooltip is either a parseable tooltip hint, or a literal text.

Declaration
public static Task<string> GetTooltipAsync(string tooltipHint, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string tooltipHint

Tooltip hint, or literal text

CancellationToken cancellationToken
Returns
Type Description
Task<string>

Formatted tooltip, possibly including image tags or other metainformation

Remarks

If it is a literal, it may be formatted according to current tooltip rules, and is then returned. A tooltip hint has the syntax {<id>=<value>[<id>=<value>]...}, ie., curly braces around the whole string, and one or more id/value pairs. The delimiter within each pair is an equals sign, and the delimiter between pairs is an ampersand. A typical hint is {contact_id=5}. Another possible hint would be {contact_id=123&simple=true}.

Id's are case-insensitive, using the OrdinalIgnoreCase comparer provided by the .NET framework.

GetTooltipHintValue(string)

Get the inner value of a dynamic tooltip hint - or nothing, if the tooltip is not a dynamic hint. Dynamic hints are delimited by braces and contain at least one name value pair.

Declaration
public static string GetTooltipHintValue(string delimitedHint)
Parameters
Type Name Description
string delimitedHint

Tooltip hint, including the braces

Returns
Type Description
string

Tooltip hint minus the braces, or string.Empty if no braces were present (then this is not a dynamic hint at all)

Remarks

Tooltip plugin providers must implement the ITooltipProviderPlugin interface, and are welcome to use the TooltipPluginBase base class as well.

A trivial tooltip example:
string myTooltip = TooltipProvider.GetTooltip("{contact_id=" + myContactId + "}");

MakeImageHint(string, int, bool)

Utility method for creating an image hint with the correct syntax, from a key and id combination. If you are programming something that is derived from TooltipPluginBase, using the MakeImageHint(string, int) is somewhat simpler than using this method.

Declaration
public static string MakeImageHint(string key, int id, bool wantImage)
Parameters
Type Name Description
string key

Key name, for instance person_id. This key must be something that is recognized by the image streaming service.

int id

ID for the given key

bool wantImage

Should the image hint be created; if false, an empty string will be returned

Returns
Type Description
string

Image hint

Remarks

Tooltip plugin providers must implement the ITooltipProviderPlugin interface, and are welcome to use the TooltipPluginBase base class as well.

A trivial tooltip example:
string myTooltip = TooltipProvider.GetTooltip("{contact_id=" + myContactId + "}");

MakeTooltipHint(string)

Utility method for creating a tooltip hint with the correct syntax, from a single key and single value

Declaration
public static string MakeTooltipHint(string keyAndValue)
Parameters
Type Name Description
string keyAndValue

Key and value with an equals sign as the delimiter

Returns
Type Description
string

Tooltip hint

Remarks

Tooltip plugin providers must implement the ITooltipProviderPlugin interface, and are welcome to use the TooltipPluginBase base class as well.

A trivial tooltip example:
string myTooltip = TooltipProvider.GetTooltip("{contact_id=" + myContactId + "}");

MakeTooltipHint(string, int)

Utility method for creating a tooltip hint with the correct syntax, from a single key and single value

Declaration
public static string MakeTooltipHint(string key, int value)
Parameters
Type Name Description
string key

Key name

int value

Key value

Returns
Type Description
string

Tooltip hint

Remarks

Tooltip plugin providers must implement the ITooltipProviderPlugin interface, and are welcome to use the TooltipPluginBase base class as well.

A trivial tooltip example:
string myTooltip = TooltipProvider.GetTooltip("{contact_id=" + myContactId + "}");
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top