Поделиться через


InkAnalyzer.Abort - метод

Обновлен: Ноябрь 2007

Cancels the current analysis operation.

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink.Analysis (в Microsoft.Ink.Analysis.dll)

Синтаксис

'Декларация
Public Function Abort As AnalysisRegion
'Применение
Dim instance As InkAnalyzer
Dim returnValue As AnalysisRegion

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

Возвращаемое значение

Тип: Microsoft.Ink.AnalysisRegion
The dirty region of current analysis operation.

Заметки

After this method is called, the InkAnalyzer stops raising events for the canceled analysis operation. If a background analysis operation is canceled, this method runs asynchronously until the InkAnalyzer stops the operation.

If no analysis operations are in progress, Abort returns an empty analysis region.

If one analysis operation is in progress, Abort cancels the operation.

If both synchronous and asynchronous analysis operations are in progress, Abort cancels the synchronous operation.

If this method is called more than once for the same analysis operation, the first call returns the dirty region for the operation and subsequent calls return an empty region.

If your application maintains its own data structure that is synchronized with that of the InkAnalyzer, calling Abort can leave your document with partial results. To avoid this, do not call Abort between the time the InkAnalyzer raises the InkAnalyzerStateChanging event and the time the InkAnalyzer raises the IntermediateResultsUpdated or ResultsUpdated event.

For more information about synchronizing your application data with the InkAnalyzer, see Data Proxy with Ink Analysis.

Примеры

This example defines an event handler for the InkAnalyzer.Activity event. If the analysis operation needs to be canceled, the event handler calls Abort on the InkAnalyzer that generated the event and updates the InkAnalyzer object's 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 theInkAnalyzer_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 InkAnalyzer that raised the Activity event.
        Dim theInkAnalyzer As Microsoft.Ink.InkAnalyzer = _
            DirectCast(sender, Microsoft.Ink.InkAnalyzer)

        ' Abort the analysis and get the region that was being analyzed.
        Dim theAnalysisRegion As Microsoft.Ink.AnalysisRegion = _
            theInkAnalyzer.Abort()

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

End Sub 'theInkAnalyzer_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 theInkAnalyzer_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 InkAnalyzer that raised the Activity event.
        Microsoft.Ink.InkAnalyzer theInkAnalyzer =
            sender as Microsoft.Ink.InkAnalyzer;

        // Abort the analysis and get the region that was being analyzed.
        Microsoft.Ink.AnalysisRegion theAnalysisRegion = theInkAnalyzer.Abort();

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

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

InkAnalyzer Класс

InkAnalyzer - члены

Microsoft.Ink - пространство имен

InkAnalyzer.Analyze

InkAnalyzer.BackgroundAnalyze

InkAnalyzer.DirtyRegion