Table of Contents

Interface ISillTextSelectionActivator

Namespace
WindowSill.API
Assembly
WindowSill.API.dll

Represents the declaration of a sill activator that will be used to determine whether a sill should be activated based on text selection in the foreground window.

public interface ISillTextSelectionActivator : ISillActivator
Extension Methods

Remarks

Each ISillTextSelectionActivator must have an ActivationTypeAttribute that defines its name and base activation type. The name of the activator is used as a unique identifier for the activator. The name can be assigned to a TextSelectionActivatorTypeNames property to indicate that this sill should be activated when GetShouldBeActivatedAsync(string, bool, CancellationToken) returns true. The base name of the activation type is used to determine dependency on other activation types. For example, there may be an activator designed to get activated when a JSON is detected. Then there could be another activator that has dependency on the JSON activator and detects when the detected JSON matches a specific schema. This allows to create a chain of activators that activates sills based on more specific conditions.

<pre><code class="lang-csharp">[(typeof())]
[("YAML Activator", baseName: )]
internal sealed class MySillActivator: 
{
}</code></pre>

Methods

GetShouldBeActivatedAsync(string, bool, CancellationToken)

Determines whether the specified text should trigger activation based on the provided conditions.

ValueTask<bool> GetShouldBeActivatedAsync(string selectedText, bool isReadOnly, CancellationToken cancellationToken)

Parameters

selectedText string

The text currently selected, which should be evaluated for activation.

isReadOnly bool

A value indicating whether the selectedText comes form a UI element that is read-only, such as a title in a web page.

cancellationToken CancellationToken

A token to monitor for cancellation requests, which cancels after 500 milliseconds.

Returns

ValueTask<bool>

A ValueTask<TResult> that represents the asynchronous operation. The result is true if activation should occur; otherwise, false.