InkAnalyzerBase.Abort 方法

取消当前分析操作。

命名空间:  System.Windows.Ink.AnalysisCore
程序集:  IACore(在 IACore.dll 中)

语法

声明
Public Function Abort As AnalysisRegionBase
用法
Dim instance As InkAnalyzerBase
Dim returnValue As AnalysisRegionBase

returnValue = instance.Abort()
public AnalysisRegionBase Abort()
public:
AnalysisRegionBase^ Abort()
public AnalysisRegionBase Abort()
public function Abort() : AnalysisRegionBase

返回值

类型:System.Windows.Ink.AnalysisCore.AnalysisRegionBase
当前分析操作的已更新区域。

备注

调用此方法后,InkAnalyzerBase 停止为取消的分析操作引发事件。如果取消的是后台分析操作,则在墨迹分析器停止该操作前,此方法异步运行。

如果未进行任何分析操作,则此方法返回一个空的分析区域。

如果有一个分析操作正在执行,则此方法将取消该操作。

如果同步分析操作和异步分析操作都在执行,则此方法将取消同步操作。

如果为同一分析操作多次调用此方法,则首次调用返回该操作的已更新区域,后续调用返回空区域。

如果您的应用程序维护其自己的数据结构,该数据结构与 InkAnalyzerBase 的数据结构同步,则调用 Abort 可造成文档包含的结果不完整。若要避免此问题,请不要在 InkAnalyzerBase 引发 InkAnalyzerStateChangingBase 事件和 InkAnalyzerBase 引发 IntermediateResultsUpdatedBaseResultsUpdatedBase 事件之间调用 Abort。

有关将应用程序数据与墨迹分析器同步的更多信息,请参见Data Proxy with Ink Analysis

示例

此示例为墨迹分析器的 ActivityBase 事件定义事件处理程序。如果需要取消分析操作,则该事件处理程序对生成该事件的 InkAnalyzerBase 调用 Abort,并更新分析器的 DirtyRegion 属性。

''' <summary>
''' The ink analyzer's Activity event handler.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The event data.</param>
Sub theInkAnalyzerBase_Activity(ByVal sender As Object, ByVal e As EventArgs)

    Dim abortAnalysis As Boolean = False

    ' Check if the analysis operation should be canceled.

    ' Abort analysis if the flag to do so is set.
    If abortAnalysis Then
        ' Get the analyzer that raised the Activity event.
        Dim theInkAnalyzerBase As System.Windows.Ink.AnalysisCore.InkAnalyzerBase = _
            DirectCast(sender, System.Windows.Ink.AnalysisCore.InkAnalyzerBase)

        ' Abort the analysis and get the region that was being analyzed.
        Dim theAnalysisRegionBase As System.Windows.Ink.AnalysisCore.AnalysisRegionBase = _
            theInkAnalyzerBase.Abort()

        ' Add the region that was being analyzed to the analyzer's dirty region.
        theInkAnalyzerBase.DirtyRegion.Union(theAnalysisRegionBase)
    End If

End Sub 'theInkAnalyzerBase_Activity
/// <summary>
/// The ink analyzer's Activity event handler.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The event data.</param>
void theInkAnalyzerBase_Activity(object sender, EventArgs e)
{
    bool abortAnalysis = false;

    // Check if the analysis operation should be canceled.

    // Abort analysis if the flag to do so is set.
    if (abortAnalysis)
    {
        // Get the analyzer that raised the Activity event.
        System.Windows.Ink.AnalysisCore.InkAnalyzerBase theInkAnalyzerBase =
            sender as System.Windows.Ink.AnalysisCore.InkAnalyzerBase;

        // Abort the analysis and get the region that was being analyzed.
        System.Windows.Ink.AnalysisCore.AnalysisRegionBase theAnalysisRegionBase =
            theInkAnalyzerBase.Abort();

        // Add the region that was being analyzed to the analyzer's dirty region.
        theInkAnalyzerBase.DirtyRegion.Union(theAnalysisRegionBase);
    }
}

平台

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkAnalyzerBase 类

InkAnalyzerBase 成员

System.Windows.Ink.AnalysisCore 命名空间

InkAnalyzerBase.Analyze

InkAnalyzerBase.BackgroundAnalyze

InkAnalyzerBase.DirtyRegion