←Select platform

FastConfiguration Event

Summary
(Document/Medical only) This event is fired for each scan configuration tested, if the value of the EnableFastConfigurationEvent property is set to true.

Syntax
C#
C++/CLI
Python
public event EventHandler<TwainFastConfigurationEventArgs> FastConfiguration 
public: 
event EventHandler<TwainFastConfigurationEventArgs^>^ FastConfiguration 
def FastConfiguration(sender,e): # sender: TwainSession e: TwainFastConfigurationEventArgs 
Event Data

The event handler receives an argument of type TwainFastConfigurationEventArgs containing data related to this event. The following TwainFastConfigurationEventArgs properties provide information specific to this event.

PropertyDescription
FastConfiguration Gets the TwainFastConfiguration object used in the scan configuration being tested.
Stop Indicates whether or not to stop the configuration test.
Remarks

To stop the scan configuration testing process, set the Stop property to true within the FastConfiguration event. The Stop property must be set to false to continue the scan configuration process. For more information, refer to Fast TWAIN (Scan Configurations).

Example
C#
using Leadtools; 
using Leadtools.Twain; 
 
 
public void twain_FastConfiguration(object sender, TwainFastConfigurationEventArgs e) 
{ 
   // ... set your code here 
   e.Stop = false; 
} 
 
public void FindFastConfigurationExample(IntPtr parent) 
{ 
   TwainSession session = new TwainSession(); 
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None); 
 
   session.EnableFastConfigurationEvent = true; 
   session.FastConfiguration += new EventHandler<TwainFastConfigurationEventArgs>(twain_FastConfiguration); 
 
   List<TwainFastConfiguration> twFastConfig = new List<TwainFastConfiguration>(); 
   TwainFastConfiguration tempFastConfig = new TwainFastConfiguration(); 
   tempFastConfig = TwainFastConfiguration.Default; 
 
   tempFastConfig.TransferMechanism = TwainTransferMode.File; 
   tempFastConfig.ImageFormat = Leadtools.RasterImageFormat.Bmp; 
   tempFastConfig.BitsPerPixel = 1; 
   twFastConfig.Add(tempFastConfig); 
 
   tempFastConfig.TransferMechanism = TwainTransferMode.File; 
   tempFastConfig.ImageFormat = Leadtools.RasterImageFormat.Tif; 
   tempFastConfig.BitsPerPixel = 1; 
   twFastConfig.Add(tempFastConfig); 
 
   TwainFindFastConfigurationResult fastConfigRes; 
 
   try 
   { 
      fastConfigRes = session.FindFastConfiguration(Path.Combine(LEAD_VARS.ImagesDir, ""), TwainFastUserInterfaceFlags.Show, 0, 1, twFastConfig); 
 
      string msg; 
      MessageBox.Show("FindFastConfig method was successful"); 
 
      msg = String.Format("Result Scan Configs count = {0}", fastConfigRes.Tested.Count); 
      MessageBox.Show(msg); 
 
      msg = String.Format("Transfer Mode = {0}\nFile Format = {1}\nBuffer Size = {2}\nRequired Time = {3}\n", 
         fastConfigRes.Tested[0].TransferMechanism, 
         fastConfigRes.Tested[0].ImageFormat, 
         fastConfigRes.Tested[0].BufferSize, 
         fastConfigRes.Tested[0].RequiredTime); 
      MessageBox.Show(msg, "Tested Scan Configurations..."); 
 
      msg = String.Format("Transfer Mode = {0}\nFile Format = {1}\nBuffer Size = {2}\nRequired Time = {3}\n", 
         fastConfigRes.Best.TransferMechanism, 
         fastConfigRes.Best.ImageFormat, 
         fastConfigRes.Best.BufferSize, 
         fastConfigRes.Best.RequiredTime); 
      MessageBox.Show(msg, "Best Scan Configurations..."); 
   } 
   catch (Exception ex) 
   { 
      MessageBox.Show(ex.Message); 
   } 
 
   session.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Twain Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.