Share via


RecognizerContext Class

Enables the ability to perform ink recognition, retrieve the recognition result, and retrieve alternates. The RecognizerContext enables the various recognizer that are installed on a system to use ink recognition to process input appropriately.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name := "FullTrust")> _
Public Class RecognizerContext _
    Implements ICloneable, IDisposable
'Usage
Dim instance As RecognizerContext
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public class RecognizerContext : ICloneable, 
    IDisposable
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Name = L"FullTrust")]
public ref class RecognizerContext : ICloneable, 
    IDisposable
public class RecognizerContext implements ICloneable, IDisposable

Remarks

Warning

To avoid a memory leak you must explicitly call the Dispose method on any RecognizerContext collection to which an event handler has been attached before the collection goes out of scope.

There are two types of recognition: background (asynchronous) or foreground (synchronous). Background recognition is started by a call to the BackgroundRecognize or BackgroundRecognizeWithAlternates methods, occurs on a background thread, and reports results to the application through an event mechanism. Foreground recognition does not return until all recognition is completed, thus making recognition results available to the calling thread without listening for the recognition event.

Ink is processed continuously in the background. If a Stroke is added to the Strokes collection to which the RecognizerContext refers, then the Stroke is then recognized immediately. See remarks in the EndInkInput method topic for more details.

All recognition occurs through a recognizer context. The context defines the settings for a single recognition session. It receives the ink that must be recognized and defines the constraints on the ink input and on the recognition output. The constraints that can be set on the context include the language, the dictionary, and grammar that is being used.

Note

Setting properties other than the Strokes or CharacterAutoCompletion properties succeeds only if the Strokes collection is nulla null reference (Nothing in Visual Basic). You must set the other properties before you attach the Strokes collection to the RecognizerContext, or you must set the Strokes collection to nulla null reference (Nothing in Visual Basic) and then set the other properties. If you set the Strokes collection to nulla null reference (Nothing in Visual Basic) and then set the other properties, you may have to reattach the Strokes collection. This is because the recognition starts right after you assign the Strokes to the RecognizerContext. When a call is made to Recognize or BackgroundRecognize, call results might be already available.

To improve your application's performance, manually dispose of a RecognizerContext object when it is no longer needed.

Inheritance Hierarchy

System.Object
  Microsoft.Ink.RecognizerContext

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

RecognizerContext Members

Microsoft.Ink Namespace

Recognizer

Strokes