Share via


RecognizerContext.StopBackgroundRecognition Method

Ends background recognition that was started with a call to BackgroundRecognize or BackgroundRecognizeWithAlternates.

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

Syntax

'Declaration
Public Sub StopBackgroundRecognition
'Usage
Dim instance As RecognizerContext

instance.StopBackgroundRecognition()
public void StopBackgroundRecognition()
public:
void StopBackgroundRecognition()
public function StopBackgroundRecognition()

Remarks

No event is fired when you call the StopBackgroundRecognition method.

Call the StopBackgroundRecognition method if you call BackgroundRecognize or BackgroundRecognizeWithAlternates one or more times. Calling StopBackgroundRecognition does not necessarily ensure that you get no results from a recognition process that is currently underway. It only ensures that all previous calls to BackgroundRecognize or BackgroundRecognizeWithAlternates that have not yet been processed are not executed.

Call this method only if you process the ink asynchronously.

Examples

In this example, when the Stroke event fires (in response to the user completing a stroke), the StopBackgroundRecognition method is called to make sure that any pending background recognition requests are cancelled. Then the newly created stroke is added to the Strokes collection of the RecognizerContext object, and the BackgroundRecognize method is called.

Private Sub mInkOverlay_Stroke2(ByVal sender As Object, ByVal e As InkCollectorStrokeEventArgs)
    ' in case background recognition is still occurring, stop it
    mRecognizerContext.StopBackgroundRecognition()
    ' add the stroke, and start recognition
    mRecognizerContext.Strokes.Add(e.Stroke)
    mRecognizerContext.BackgroundRecognize()
End Sub
private void mInkOverlay_Stroke2(object sender, InkCollectorStrokeEventArgs e)
{
    // in case background recognition is still occurring, stop it
    mRecognizerContext.StopBackgroundRecognition();
    // add the stroke, and start recognition
    mRecognizerContext.Strokes.Add(e.Stroke);
    mRecognizerContext.BackgroundRecognize();
}

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 Class

RecognizerContext Members

Microsoft.Ink Namespace

RecognizerContext.BackgroundRecognize

RecognizerContext.BackgroundRecognizeWithAlternates