共用方式為


AnalysisWarningBase.BackgroundException 屬性

如果在背景筆墨分析期間發生例外狀況,所擲回的 Exception

命名空間:  System.Windows.Ink.AnalysisCore
組件:  IACore (在 IACore.dll 中)

語法

'宣告
Public ReadOnly Property BackgroundException As Exception
'用途
Dim instance As AnalysisWarningBase
Dim value As Exception

value = instance.BackgroundException
public Exception BackgroundException { get; }
public:
property Exception^ BackgroundException {
    Exception^ get ();
}
/** @property */
public Exception get_BackgroundException()
public function get BackgroundException () : Exception

屬性值

型別:System.Exception
在背景分析期間所擲回的 Exception

備註

如果在 InkAnalyzerBase.BackgroundAnalyze 呼叫之後發生 Exception,則無法擲回例外狀況,因為它是在不同的執行緒中發生,所以無法攔截。相反地,在 ResultsUpdated 事件處理常式中,ResultsUpdatedEventArgs 物件的 Status 屬性在它的 Warnings 集合中會有 BackgroundException 型別的 AnalysisWarningBase 物件。這個 AnalysisWarningBase 物件的 BackgroundException 屬性會包含背景分析期間擲回的 Exception。一般來說,您會想要重新擲回這個 Exception,以便在應用程式的其他位置攔截它。

範例

下列範例會示範如何檢查 AnalysisWarningBase (warning) 是否有任何相關聯的提示。如果 AnalysisWarningBase 屬於 BackgroundException 型別,您應該嘗試盡量儲存文件狀態,然後重新擲回例外狀況,讓例外處理常式攔截它。即使沒有適當的例外處理常式,也會叫用程式錯誤偵錯工具,例如 Dr. Watson。攔截例外狀況之後,InkAnalyzerBase 必須重新初始化。

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

平台

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

AnalysisWarningBase 類別

AnalysisWarningBase 成員

System.Windows.Ink.AnalysisCore 命名空間

InkAnalyzerBase.BackgroundAnalyze