Expand Minimize

AnalysisWarningCode Enumeration

Defines values for the set of available warnings that can occur during ink analysis.

Namespace:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

public enum AnalysisWarningCode

Member nameDescription
AbortedIndicates the analysis operation was aborted. Returned only when the synchronous analysis operation is called. Aborting an asynchronous operation will not raise a ResultsUpdated event.
NoMatchingInkRecognizerFoundIndicates that there are not any ink recognizers that meet the language or capabilities needed to perform the text recognition operation installed on the system.
FactoidNotSupportedIndicates that the ink recognizer was unable to respect the specified Factoid.
FactoidCoercionNotSupportedIndicates that the ink recognizer was unable to coerce its results to the specified Factoid.
GuideNotSupportedIndicates that the ink recognizer was unable to respect the specified Guide.
WordlistNotSupportedIndicates that the ink recognizer was unable to respect the specified word list set by SetWordlist.
WordModeNotSupportedIndicates that the ink recognizer was unable to respect the specified WordMode.
PartialDictionaryTermsNotSupportedIndicates that partial dictionary terms could not be returned from the InkRecognizer.
TextRecognitionProcessFailedIndicates the text recognition process failed.
AddInkToRecognizerFailedIndicates that the ink could not be added to the InkRecognizerBase. For example, adding strokes collected from a mouse on a gesture recognizer will fail, as the gesture recognizer requires strokes collected from a digitizer.
SetPrefixSuffixFailedIndicates that the InkRecognizerBase was unable to respect the specified PrefixText or SuffixText value.
InkRecognizerInitializationFailedIndicates that the InkRecognizer could not be instantiated, cloned or that setting strokes on the recognizer’s context failed.
ConfirmedWithoutInkRecognitionIndicates that a ContextNode has been confirmed by the user without having any recognition values computed for the node.
BackgroundExceptionIndicates that the background operation did not complete due to an exception. This is a fatal error and requires the InkAnalyzer is re-instantiated before further use.
ContextNodeLocationNotSetIndicates that a ContextNode does not have a proper Location set. The Location property must have a non-empty value unless the ContextNode is marked as partially populated.
LanguageIdNotRespectedIndicates that the language identifier set on a stroke associated with a CustomRecognizer did not match the language identifier of the InkRecognizer used. The ink was still recognized with the specified InkRecognizer.
EnableUnicodeCharacterRangesNotSupportedIndicates that the InkRecognizer does not support enabling Unicode character ranges as specified in the hint.
TopInkBreaksOnlyNotSupportedIndicates that the InkRecognizer does not support TopInkBreaksOnly even though the hints contain a request for TopInkBreaks only.
AnalysisAlreadyRunningIndicates that the InkAnalyzer is already performing background analysis.

BackgroundException is the only warning that requires the InkAnalyzer to be re-instantiated before further use.

Other warnings, such as InkRecognizerInitializationFailed and TextRecognitionProcessFailed, might require that the InkAnalyzer use a different recognizer.

The following example loops through all warnings in an AnalysisWarningCollection, warnings. It provides a message, depending on the AnalysisWarningCode. In the case of BackgroundException, it throws the exception, since this is a fatal warning. It then marks the strokes that generated the warning in red.

// 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;
}

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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.

.NET Framework

Supported in: 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft