Partager via


AnalysisWarningCode, énumération

Mise à jour : November 2007

Définit des valeurs de l'ensemble d'avertissements disponibles qui peuvent se produire pendant l'analyse d'entrée manuscrite.

Espace de noms :  System.Windows.Ink.AnalysisCore
Assembly :  IACore (dans IACore.dll)

Syntaxe

'Déclaration
Public Enumeration AnalysisWarningCode
'Utilisation
Dim instance As AnalysisWarningCode
public enum AnalysisWarningCode
public enum class AnalysisWarningCode
public enum AnalysisWarningCode
public enum AnalysisWarningCode

Membres

Nom de membre Description
Aborted Indique que l'analyse a été abandonnée. Est retourné uniquement lorsque l'analyse synchrone est appelée. L'abandon d'une opération asynchrone ne déclenche pas d'événement ResultsUpdated.
NoMatchingInkRecognizerFound Indique qu'aucun module de reconnaissance de l'écriture manuscrite correspondant à la langue ou aux fonctionnalités nécessaires à la reconnaissance de texte n'est installé sur le système.
FactoidNotSupported Indique que le module de reconnaissance de l'écriture manuscrite n'est pas parvenu à respecter la propriété Factoid() spécifiée.
FactoidCoercionNotSupported Indique que le module de reconnaissance de l'écriture manuscrite n'est pas parvenu à forcer la correspondance de ses résultats avec le Factoid spécifié.
GuideNotSupported Indique que le module de reconnaissance de l'écriture manuscrite n'est pas parvenu à respecter le Guide spécifié.
WordlistNotSupported Indique que le module de reconnaissance de l'écriture manuscrite n'a pas pu respecter la liste de mots spécifiée définie par SetWordlist.
WordModeNotSupported Indique que le module de reconnaissance de l'écriture manuscrite n'est pas parvenu à respecter le WordMode spécifié.
PartialDictionaryTermsNotSupported Indique que les termes de dictionnaire partiels n'ont pas pu être retournés à partir du InkRecognizer.
TextRecognitionProcessFailed Indique que le processus de reconnaissance du texte a échoué.
AddInkToRecognizerFailed Indique que l'entrée manuscrite n'a pu être ajoutée au InkRecognizerBase. Par exemple, l'ajout des traits collectés avec une souris sur un module de reconnaissance de mouvements échoue car la reconnaissance nécessite des traits collectés avec un digitaliseur.
SetPrefixSuffixFailed Indique que le InkRecognizerBase n'a pas pu respecter la valeur PrefixText ou SuffixText spécifiée.
InkRecognizerInitializationFailed Indique que le InkRecognizer n'a pas pu être instancié ou cloné ou que la définition des traits sur le contexte du module de reconnaissance a échoué.
ConfirmedWithoutInkRecognition Indique que l'utilisateur a confirmé un ContextNode sans qu'une valeur de reconnaissance ait été calculée pour le nœud.
BackgroundException Indique que l'opération d'arrière-plan ne s'est pas terminée en raison d'une exception. Il s'agit d'une erreur irrécupérable. InkAnalyzer est ré-instancié avant une utilisation ultérieure.
ContextNodeLocationNotSet Indique qu'un ContextNode n'a pas d'ensemble approprié de Location. La propriété Location doit avoir une valeur non vide sauf si le ContextNode est marqué comme partiellement rempli.
LanguageIdNotRespected Indique que l'identificateur de langue défini sur un trait associé à un CustomRecognizer ne correspond pas à l'identificateur de langue du InkRecognizer utilisé. L'entrée manuscrite est toujours reconnue avec le InkRecognizer spécifié.
EnableUnicodeCharacterRangesNotSupported Indique que le InkRecognizer ne prend pas en charge l'activation de plages de caractères Unicode comme spécifié dans l'indication.
TopInkBreaksOnlyNotSupported Indique que le InkRecognizer ne prend pas en charge TopInkBreaksOnly même si les indications ne contiennent qu'une demande pour TopInkBreaks.
AnalysisAlreadyRunning Indique que le InkAnalyzer exécute déjà l'analyse d'arrière-plan.

Notes

BackgroundException est le seul avertissement qui nécessite que le InkAnalyzer soit ré-instancié avant une utilisation ultérieure.

D'autres avertissements, tels que InkRecognizerInitializationFailed et TextRecognitionProcessFailed, peuvent nécessiter que le InkAnalyzer utilise un autre module de reconnaissance.

Exemples

L'exemple suivant parcourt en boucle tous les avertissements d'un AnalysisWarningCollection, warnings. Il fournit un message, dépendant du AnalysisWarningCode. Dans le cas de BackgroundException, il lève l'exception, puisqu'il s'agit d'un avertissement fatal. Il marque ensuite les traits qui ont généré l'avertissement en rouge.

' Loop through warnings
Dim warning As AnalysisWarningBase
For Each warning In status.Warnings
    Select Case warning.WarningCode
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.Aborted
            message = message & "Analysis operation was aborted. "
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.BackgroundException
            ' This is a fatal warning. Throw an exception.
            ' First, attempt to save as much document state as possible 
            ' ...

            ' Rethrow the exception so that it can be caught by an exception
            ' handler (or if there is no exception handler, a program error 
            ' debugger such as Dr. Watson can be invoked)
            Throw (warning.BackgroundException)
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.ConfirmedWithoutInkRecognition
            message = message & "Node was confirmed without ink recognition having been performed. "
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.ContextNodeLocationNotSet
            message = message & "Node does not have a proper location set. "
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.FactoidCoercionNotSupported
            message = message & "Factoid coercion failed "
            If (Not warning.AnalysisHint Is Nothing) AndAlso _
                warning.AnalysisHint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.Factoid) Then
                message = message & "for factoid: " & _
                    CType(warning.AnalysisHint.GetPropertyData( _
                          PropertyGuidsForAnalysisHintsBase.Factoid), String) & ". "
            End If
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.FactoidNotSupported

            If (Not warning.AnalysisHint Is Nothing) AndAlso _
                warning.AnalysisHint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.Factoid) Then
                message = message & _
                    CType(warning.AnalysisHint.GetPropertyData( _
                          PropertyGuidsForAnalysisHintsBase.Factoid), String) & _
                    " factoid was not respected. "
            End If
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.GuideNotSupported
            message = message & "Guide was not respected. "
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.AddInkToRecognizerFailed
            message = message & "Ink could not be added to the InkRecognizer. "
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.InkRecognizerInitializationFailed
            message = message & "The InkRecognizer failed to initialize. "
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.NoMatchingInkRecognizerFound
            message = message & "There are no ink recognizers meeting the language or capabilities needed. "
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.LanguageIdNotRespected
            message = message & "The language ID set on a stroke did not match the language ID of the InkRecognizer. "
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.PartialDictionaryTermsNotSupported
            message = message & "Partial dictionary terms could not be returned from the text recognizer. "
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.SetPrefixSuffixFailed
            message = message & "The text recognizer was unable to respect either the prefix or suffix. "
            If (Not warning.AnalysisHint Is Nothing) AndAlso _
                warning.AnalysisHint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.PrefixText) Then
                message = message & "Prefix: " & _
                    warning.AnalysisHint.GetPropertyData(PropertyGuidsForAnalysisHintsBase.PrefixText) _
                    & ". "
            End If
            If (Not warning.AnalysisHint Is Nothing) AndAlso _
                warning.AnalysisHint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.SuffixText) Then
                message = message & "Suffix: " & _
                    warning.AnalysisHint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.SuffixText) _
                    & ". "
            End If
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.WordlistNotSupported
            message = message & "Wordlist was not respected. "
        Case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.WordModeNotSupported
            message = message & "Word mode was not respected. "
    End Select


    ' Add node id information
    Dim id As Guid
    For Each id In warning.GetNodeIds()
        message = message & "Id: " & id.ToString() & " "
    Next id


    ' Add hint information
    If Not (warning.AnalysisHint Is Nothing) Then

        Dim hint As ContextNodeBase = warning.AnalysisHint
        message = message & Environment.NewLine & "Hint information: "
        message = message & "AllowPartialDictionaryTerms"
        If hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.AllowPartialDictionaryTerms) Then
            message = message & " = " & _
                hint.GetPropertyData( _
                    PropertyGuidsForAnalysisHintsBase.AllowPartialDictionaryTerms).ToString()
        Else
            message = message & " = False "
        End If
        message = message & "CoerceToFactoid"
        If hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.CoerceToFactoid) Then
            message = message & " = " & _
                hint.GetPropertyData( _
                    PropertyGuidsForAnalysisHintsBase.CoerceToFactoid).ToString()
        Else
            message = message & " = False "
        End If
        If hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.Factoid) Then
            message = message & "Factoid = " & _
                warning.AnalysisHint.GetPropertyData(PropertyGuidsForAnalysisHintsBase.Factoid) & " "
        End If
        If hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.Guide) Then
            Dim theInkRecognizerGuideBase As InkRecognizerGuideBase = _
                CType(hint.GetPropertyData(PropertyGuidsForAnalysisHintsBase.Guide), _
                      InkRecognizerGuideBase)

            message += "Guide Drawn Box = {" & theInkRecognizerGuideBase.DrawnBoxLeft.ToString() _
                                          & ", " & theInkRecognizerGuideBase.DrawnBoxTop.ToString() _
                                          & ", " & theInkRecognizerGuideBase.DrawnBoxRight.ToString() _
                                          & ", " & theInkRecognizerGuideBase.DrawnBoxBottom.ToString() _
                                          & ")"

            message &= "Guide Writing Box = {" & theInkRecognizerGuideBase.WritingBoxLeft.ToString() _
                                            & ", " & theInkRecognizerGuideBase.WritingBoxTop.ToString() _
                                            & ", " & theInkRecognizerGuideBase.WritingBoxRight.ToString() _
                                            & ", " & theInkRecognizerGuideBase.WritingBoxBottom.ToString() _
                                            & ")"

            message = message & String.Format("Guide = ({0}, {1})", _
                 theInkRecognizerGuideBase.Columns, theInkRecognizerGuideBase.Rows)

        End If

        If hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.Name) Then
            message = message & "Name = " & _
                CType(warning.AnalysisHint.GetPropertyData(PropertyGuidsForAnalysisHintsBase.Name), String) _
                & " "
        End If

        If Not hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.PrefixText) Then
            message = message & "PrefixText = " & _
                CType(warning.AnalysisHint.GetPropertyData(PropertyGuidsForAnalysisHintsBase.PrefixText), String) _
                & " "
        End If

        If Not hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.SuffixText) Then
            message = message & "SuffixText = " & _
                CType(warning.AnalysisHint.GetPropertyData(PropertyGuidsForAnalysisHintsBase.SuffixText), String) _
                & " "
        End If

        message = message & "WordMode"
        If hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.WordMode) Then
            message = message & " = " & _
                CType(hint.GetPropertyData(PropertyGuidsForAnalysisHintsBase.WordMode), String)
        Else
            message = message & " = False"
        End If
    End If

    message = message & Environment.NewLine
Next warning
// Loop through warnings
foreach (AnalysisWarningBase warning in status.Warnings)
{
    switch (warning.WarningCode)
    {
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.Aborted:
            message += "Analysis operation was aborted. ";
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.BackgroundException:
            // This is a fatal warning. Throw an exception.
            // First, attempt to save as much doc state as possible 
            // ...

            // Rethrow the exception so that it can be caught by an exception
            // handler (or if there is no exception handler, a program error 
            // debugger such as Dr. Watson can be invoked)
            throw(warning.BackgroundException);
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.ConfirmedWithoutInkRecognition:
            message += "Node was confirmed without ink recognition having been performed. ";
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.ContextNodeLocationNotSet:
            message += "Node does not have a proper location set. ";
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.FactoidCoercionNotSupported:
            message += "Factoid coercion failed ";
            if (warning.AnalysisHint != null && 
                warning.AnalysisHint.ContainsPropertyData(
                        PropertyGuidsForAnalysisHintsBase.Factoid))
            {
                message += "for factoid: " + 
                    (string) warning.AnalysisHint.GetPropertyData(
                        PropertyGuidsForAnalysisHintsBase.Factoid) + ". ";
            } 
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.FactoidNotSupported:
            if (warning.AnalysisHint != null &&
                warning.AnalysisHint.ContainsPropertyData(
                        PropertyGuidsForAnalysisHintsBase.Factoid))
            {
                message +=
                    (string)warning.AnalysisHint.GetPropertyData(
                        PropertyGuidsForAnalysisHintsBase.Factoid) 
                     + " factoid was not respected. ";
            }
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.GuideNotSupported:
            message += "Guide was not respected. ";
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.AddInkToRecognizerFailed:
            message += "Ink could not be added to the InkRecognizer. ";
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.InkRecognizerInitializationFailed:
            message += "The InkRecognizer failed to initialize. ";
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.NoMatchingInkRecognizerFound:
            message += "There are no ink recognizers meeting the language or capabilities needed. ";
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.LanguageIdNotRespected:
            message += "The language ID set on a stroke did not match the language ID of the InkRecognizer. ";
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.PartialDictionaryTermsNotSupported:
            message += "Partial dictionary terms could not be returned from the text recognizer. ";
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.SetPrefixSuffixFailed:
            message += "The text recognizer was unable to respect either the prefix or suffix. ";
            if (warning.AnalysisHint != null && 
                warning.AnalysisHint.ContainsPropertyData(
                    PropertyGuidsForAnalysisHintsBase.PrefixText))
            {
                message += "Prefix: " + 
                    warning.AnalysisHint.GetPropertyData(
                        PropertyGuidsForAnalysisHintsBase.PrefixText) + ". ";
            }
            if (warning.AnalysisHint != null &&
                warning.AnalysisHint.ContainsPropertyData(
                    PropertyGuidsForAnalysisHintsBase.SuffixText))
            {
                message += "Suffix: " +
                    warning.AnalysisHint.GetPropertyData(
                        PropertyGuidsForAnalysisHintsBase.SuffixText) + ". ";
            }
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.WordlistNotSupported:
            message += "Wordlist was not respected. ";
            break;
        case System.Windows.Ink.AnalysisCore.AnalysisWarningCode.WordModeNotSupported:
            message += "Word mode was not respected. ";
            break;
    }

    // Add node id information
    foreach (Guid id in warning.GetNodeIds())
        message += "Id: " + id.ToString() + " ";

    // Add hint information
    if (warning.AnalysisHint != null)
    {
        ContextNodeBase  hint = warning.AnalysisHint;
        message += Environment.NewLine + "Hint information: ";
        message += "AllowPartialDictionaryTerms";

        if (hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.AllowPartialDictionaryTerms))
            message += " = " +
                ((bool)hint.GetPropertyData(
                    PropertyGuidsForAnalysisHintsBase.AllowPartialDictionaryTerms)).ToString();
        else
            message += " = false ";

        message += "CoerceToFactoid";
        if (hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.CoerceToFactoid))
            message += " = " +
                ((bool)hint.GetPropertyData(
                    PropertyGuidsForAnalysisHintsBase.CoerceToFactoid)).ToString();
        else
            message += " = false ";

        if (hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.Factoid))
            message += "Factoid = " + 
                (string) warning.AnalysisHint.GetPropertyData(
                PropertyGuidsForAnalysisHintsBase.Factoid) + " ";

        if (hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.Guide))
        {
            InkRecognizerGuideBase theInkRecognizerGuideBase = 
                (InkRecognizerGuideBase) hint.GetPropertyData(
                PropertyGuidsForAnalysisHintsBase.Guide);

            message += "Guide Drawn Box = {" + theInkRecognizerGuideBase.DrawnBoxLeft.ToString()
                                      + ", " + theInkRecognizerGuideBase.DrawnBoxTop.ToString()
                                      + ", " + theInkRecognizerGuideBase.DrawnBoxRight.ToString()
                                      + ", " + theInkRecognizerGuideBase.DrawnBoxBottom.ToString() 
                                      + ")";

            message += "Guide Writing Box = {" + theInkRecognizerGuideBase.WritingBoxLeft.ToString()
                                        + ", " + theInkRecognizerGuideBase.WritingBoxTop.ToString()
                                        + ", " + theInkRecognizerGuideBase.WritingBoxRight.ToString()
                                        + ", " + theInkRecognizerGuideBase.WritingBoxBottom.ToString()
                                        + ")";  

        }
        if (hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.Name))
            message += "Name = " +
                (string) warning.AnalysisHint.GetPropertyData(
                    PropertyGuidsForAnalysisHintsBase.Name);

        if (hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.PrefixText))
            message += "PrefixText = " + 
                (string) warning.AnalysisHint.GetPropertyData(
                    PropertyGuidsForAnalysisHintsBase.PrefixText) + " ";
        if (hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.SuffixText))
            message += "SuffixText = " + 
                (string) warning.AnalysisHint.GetPropertyData(
                    PropertyGuidsForAnalysisHintsBase.SuffixText) + " ";
        message += "WordMode";

        if (hint.ContainsPropertyData(PropertyGuidsForAnalysisHintsBase.WordMode))
            message += " = " +
                ((bool) hint.GetPropertyData(
                    PropertyGuidsForAnalysisHintsBase.WordMode)).ToString();
        else
            message += " = false";
    }
    message += Environment.NewLine;
}

Plateformes

Windows Vista, Windows XP SP2, Windows Server 2003

Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Informations de version

.NET Framework

Pris en charge dans : 3.0

Voir aussi

Référence

System.Windows.Ink.AnalysisCore, espace de noms

AnalysisWarningBase.WarningCode