Share via


InkRecognizer.SetAsHighestPriorityInkRecognizer Method

Sets this InkRecognizer to the highest priority in the InkAnalyzer internal ordered list of recognizers.

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

Syntax

'Declaration
Public Sub SetAsHighestPriorityInkRecognizer
'Usage
Dim instance As InkRecognizer

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

Remarks

Each recognizer contains values that describe its supported languages and supported capabilities. By organizing the available recognizers into an ordered list, the InkAnalyzer can determine which recognizer to use if two or more recognizers support both the same language and capabilities. The InkAnalyzer will store an internal ordered list of recognizers. The internal ordered list will be populated dynamically each time it is called.

Note

If performance is slow due to accessing the registry, we may restrict this to only check the registry values when the InkAnalyzer is created.

The internal list will be ordered based on the following logic:

  1. Check to see if the Control Panel application has set an order by looking at the “Recognizers Precedence” registry key values:

    1. “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\TPG\Recognizers Precedence”

    2. Each recognizer is listed as a registry sub-key by GUID.

    3. Each registry sub-key has one dword value called “Order”, which is a zero based order (0=first recognizer to use, 1= second recognizer to use… n = last recognizer to use).

    4. If the “Recognizers Precedence” key does not exists, or is corrupted, simply skip to the next step.

  2. Check to see if all installed Microsoft recognizers are represented in the ordered list by checking the “System Recognizer” registry keys. Any Microsoft recognizer that is found on the system but not included in the ordered list will be added to the end of the list, in the order found.

  3. Check to see if all installed external (3rd party) recognizers are represented in the ordered list by checking the “Recognizer” registry keys. Any external recognizer that is found on the system but not included in the ordered list will be added to the end of the list, in the order found.

Once the default ordering is built, applications may change or override the default ordering by calling this method and promoting a recognzier to the top of the list.

Use of the recognizers will be evaluated based on their order in the list:

  • The parser will start with the first recognizer in the list.

  • The first recognizer will be tested to see if it supports the language and capabilities of the ink being recognized.

  • If supported, the recognizer is used.

  • If not supported the next recognizer in the list is checked. Iteration through the list continues until a recognizer is found or the list is exhausted.

  • If no recognizer is found, the TPG_No_Suitable_Recognizer_Found exception is returned.

Examples

In this example, each InkRecognizer that is available to an InkAnalyzer object is examined. If the InkRecognizer supports language ID 1031 (German), it is set as the highest priority recognizer.

Dim allInkRecognizers As InkRecognizerCollection = mInkAnalyzer.GetInkRecognizersByPriority()
For Each IR As InkRecognizer In allInkRecognizers
    For Each langID As Integer In IR.GetLanguages()
        If langID = 1031 Then
            IR.SetAsHighestPriorityInkRecognizer()
        End If 
    Next 
Next
InkRecognizerCollection allInkRecognizers = mInkAnalyzer.GetInkRecognizersByPriority();
foreach (InkRecognizer IR in allInkRecognizers)
{
    foreach(int langID in IR.GetLanguages()) 
    {
        if (langID == 1031)
        {
            IR.SetAsHighestPriorityInkRecognizer();
        }
    }
}

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

InkRecognizer Class

InkRecognizer Members

Microsoft.Ink Namespace