Leadtools.Forms Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
FormProgressCallback Delegate
See Also  Example
Leadtools.Forms Namespace : FormProgressCallback Delegate



currentPage
The 1-based index of the current page.
totalPages
The total number of pages.
percentage
A value between 0 and 100 that represents the percent completion of the process.
Optional delegate method that reports the progress of a specific operation and offers the client an opportunity to cancel.

Syntax

Visual Basic (Declaration) 
Public Delegate Function FormProgressCallback( _
   ByVal currentPage As Integer, _
   ByVal totalPages As Integer, _
   ByVal percentage As Integer _
) As Boolean
Visual Basic (Usage)Copy Code
Dim instance As New FormProgressCallback(AddressOf HandlerMethod)
C# 
public delegate bool FormProgressCallback( 
   int currentPage,
   int totalPages,
   int percentage
)
C++/CLI 
public delegate bool FormProgressCallback( 
   int currentPage,
   int totalPages,
   int percentage
)

Parameters

currentPage
The 1-based index of the current page.
totalPages
The total number of pages.
percentage
A value between 0 and 100 that represents the percent completion of the process.

Example

This example compares a Master Form attribute with a Form attributes.

Visual BasicCopy Code
' Text writer to save the log to
Private _log As StreamWriter
Public Function ProgressCallbackExample(ByVal recognitionEngine As FormRecognitionEngine, ByVal master As FormRecognitionAttributes, ByVal form As FormRecognitionAttributes) As FormRecognitionResult
   Return recognitionEngine.CompareForm(master, form, AddressOf MyFormProgressCallback, AddressOf MyPageProgressCallback)
End Function
Private Sub MyPageProgressCallback(ByVal data As PageProgressCallbackData)
   If data.Percentage = 0 Then
      _log.WriteLine("--------------------------")
   End If

   _log.WriteLine("Page progress:{0}%", data.Percentage.ToString("000"))
End Sub

Private Function MyFormProgressCallback(ByVal currentPage As Integer, ByVal totalPages As Integer, ByVal percentage As Integer) As Boolean
   If percentage = 0 Then
      _log.WriteLine("--------------------------")
   End If

   _log.WriteLine("Page:{0}/{1} {2}%", currentPage.ToString("00"), totalPages.ToString("00"), percentage.ToString("000"))

   Return False
End Function
C#Copy Code
// Text writer to save the log to  
private StreamWriter _log;  
public FormRecognitionResult ProgressCallbackExample(FormRecognitionEngine recognitionEngine, FormRecognitionAttributes master, FormRecognitionAttributes form) 

   return recognitionEngine.CompareForm(master, form, MyFormProgressCallback, MyPageProgressCallback); 

private void MyPageProgressCallback(PageProgressCallbackData data) 

   if(data.Percentage == 0) 
      _log.WriteLine("--------------------------"); 
 
   _log.WriteLine("Page progress:{0}%", 
      data.Percentage.ToString("000")); 

 
private bool MyFormProgressCallback(int currentPage, int totalPages, int percentage) 

   if(percentage == 0) 
      _log.WriteLine("--------------------------"); 
 
   _log.WriteLine("Page:{0}/{1} {2}%", 
      currentPage.ToString("00"), 
      totalPages.ToString("00"), 
      percentage.ToString("000"));  
 
   return false; 
}

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

Leadtools.Forms requires a Forms Module license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features