Share via


InkAnalyzer.Abort Method

Cancels the current analysis operation.

Namespace:  System.Windows.Ink
Assembly:  IAWinFX (in IAWinFX.dll)

Syntax

'Declaration
Public Function Abort As AnalysisRegion
'Usage
Dim instance As InkAnalyzer 
Dim returnValue As AnalysisRegion 

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

Return Value

Type: System.Windows.Ink.AnalysisRegion
The dirty region of current analysis operation.

Remarks

InkAnalyzer stops raising events for the canceled analysis operation once this method is called. If a background analysis operation is canceled, this method runs asynchronously until InkAnalyzer stops the operation. Be sure to consider the following conditions:

  • 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 synchronized data structure with that of the InkAnalyzer, calling Abort can produce documents that contain only partial results. To avoid partial results, do not call Abort from the time that InkAnalyzer raises the InkAnalyzerStateChanging event, to the time that the InkAnalyzer raises either the IntermediateResults event or the Results event.

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

Examples

This example defines an event handler for the InkAnalyzer.Activity event. If the analysis operation needs to be canceled, the event handler calls the Abort method on the InkAnalyzer that generated the event, thereby updating 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 InkAnalyzer = sender

        ' Abort the analysis and get the region that was being analyzed. 
        Dim theAnalysisRegion As 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.
        InkAnalyzer theInkAnalyzer =
            sender as InkAnalyzer;

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

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

Platforms

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.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkAnalyzer Class

InkAnalyzer Members

System.Windows.Ink Namespace

InkAnalyzer.Analyze

InkAnalyzerBaseBackgroundAnalyze

InkAnalyzer.DirtyRegion