This documentation is archived and is not being maintained.

AnalysisWarningCollection Class

Contains a collection of AnalysisWarning objects that are the result of an ink analysis.

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

'Declaration
Public Class AnalysisWarningCollection _
	Implements ICollection, IEnumerable
'Usage
Dim instance As AnalysisWarningCollection

The following example shows how to loop through the warnings in an AnalysisStatus object, status, react to each warning, and populate a message string, message, with the warning information.

' Loop through warnings 
Dim warning As AnalysisWarning
For Each warning In status.Warnings
    Select Case warning.WarningCode
        Case Microsoft.Ink.AnalysisWarningCode.Aborted
            message = message & "Analysis operation was aborted. " 
        Case Microsoft.Ink.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 Microsoft.Ink.AnalysisWarningCode.ConfirmedWithoutInkRecognition
            message = message & "Node was confirmed without ink recognition having been performed. " 
        Case Microsoft.Ink.AnalysisWarningCode.ContextNodeLocationNotSet
            message = message & "Node does not have a proper location set. " 
        Case Microsoft.Ink.AnalysisWarningCode.FactoidCoercionNotSupported
            message = message & "Factoid coercion failed " 
            If (Not warning.AnalysisHint Is Nothing) AndAlso (Not warning.AnalysisHint.Factoid Is Nothing) Then
                message = message & "for factoid: " & warning.AnalysisHint.Factoid & ". " 
            End If 
        Case Microsoft.Ink.AnalysisWarningCode.FactoidNotSupported
            If (Not warning.AnalysisHint Is Nothing) AndAlso (Not warning.AnalysisHint.Factoid Is Nothing) Then
                message = message & warning.AnalysisHint.Factoid & " factoid was not respected. " 
            End If 
        Case Microsoft.Ink.AnalysisWarningCode.GuideNotSupported
            message = message & "Guide was not respected. " 
        Case Microsoft.Ink.AnalysisWarningCode.AddInkToRecognizerFailed
            message = message & "Ink could not be added to the InkRecognizer. " 
        Case Microsoft.Ink.AnalysisWarningCode.InkRecognizerInitializationFailed
            message = message & "The InkRecognizer failed to initialize. " 
        Case Microsoft.Ink.AnalysisWarningCode.NoMatchingInkRecognizerFound
            message = message & "There are no ink recognizers meeting the language or capabilities needed. " 
        Case Microsoft.Ink.AnalysisWarningCode.LanguageIdNotRespected
            message = message & "The language ID set on a stroke did not match the language ID of the InkRecognizer. " 
        Case Microsoft.Ink.AnalysisWarningCode.PartialDictionaryTermsNotSupported
            message = message & "Partial dictionary terms could not be returned from the text recognizer. " 
        Case Microsoft.Ink.AnalysisWarningCode.TextRecognitionProcessFailed
            message = message & "The text recognition process failed. " 
        Case Microsoft.Ink.AnalysisWarningCode.SetPrefixSuffixFailed
            message = message & "The text recognizer was unable to respect either the prefix or suffix. " 
            If (Not warning.AnalysisHint Is Nothing) AndAlso (Not warning.AnalysisHint.PrefixText Is Nothing) Then
                message = message & "Prefix: " & warning.AnalysisHint.PrefixText & ". " 
            End If 
            If (Not warning.AnalysisHint Is Nothing) AndAlso (Not warning.AnalysisHint.SuffixText Is Nothing) Then
                message = message & "Suffix: " & warning.AnalysisHint.SuffixText & ". " 
            End If 
        Case Microsoft.Ink.AnalysisWarningCode.WordlistNotSupported
            message = message & "Wordlist was not respected. " 
        Case Microsoft.Ink.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 AnalysisHintNode = warning.AnalysisHint
        message = message & Environment.NewLine & "Hint information: "
        message = message & "AllowPartialDictionaryTerms" 
        If hint.AllowPartialDictionaryTerms = True Then
            message = message & " = True " 
        Else
            message = message & " = False " 
        End If
        message = message & "CoerceToFactoid" 
        If hint.CoerceToFactoid = True Then
            message = message & " = True " 
        Else
            message = message & " = False " 
        End If 
        If Not hint.Factoid Is Nothing Then
            message = message & "Factoid = " & warning.AnalysisHint.Factoid & " " 
        End If 
        If hint.Guide.DrawnBox <> Rectangle.Empty Then
            message = message & "Guide Drawn Box = " & hint.Guide.DrawnBox.ToString()
        End If 
        If hint.Guide.WritingBox <> Rectangle.Empty Then
            message = message & "Guide Writing Box = " & hint.Guide.WritingBox.ToString()
        End If
        message = message & String.Format("Guide = ({0}, {1})", _
             hint.Guide.Columns, hint.Guide.Rows)
        If Not hint.Name Is Nothing Then
            message = message & "Name = " & warning.AnalysisHint.Name & " " 
        End If 
        If Not hint.PrefixText Is Nothing Then
            message = message & "PrefixText = " & warning.AnalysisHint.PrefixText & " " 
        End If 
        If Not hint.SuffixText Is Nothing Then
            message = message & "SuffixText = " & warning.AnalysisHint.SuffixText & " " 
        End If
        message = message & "WordMode" 
        If hint.WordMode = True Then
            message = message & " = True" 
        Else
            message = message & " = False" 
        End If 
    End If

    message = message & Environment.NewLine
Next warning

System.Object
  Microsoft.Ink.AnalysisWarningCollection

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.

.NET Framework

Supported in: 3.0
Show: