다음을 통해 공유


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
Public Class RecognizerContext
    Implements ICloneable, IDisposable
'Usage
Dim instance As RecognizerContext
public class RecognizerContext : ICloneable, IDisposable
public ref class RecognizerContext : ICloneable, IDisposable
public class RecognizerContext implements ICloneable, IDisposable
public class RecognizerContext implements ICloneable, IDisposable
Not applicable.

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 a 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 a null reference (Nothing in Visual Basic) and then set the other properties. If you set the Strokes collection to a 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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

RecognizerContext Members
Microsoft.Ink Namespace
Recognizer
Strokes