VintaSoft Twain .NET SDK Discussions
Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.
Board index < VintaSoft Twain < VintaSoft Twain .NET SDK Discussions
My question actually relates to the 'Aquire' method (not AquireModal). Is it possible to run *that* on a separate thread?Acquire method also can be used when you acquire image(s) in the background thread. Do you have any problems?
[STAThread]
static void Main(string[] args)
{
Thread thread1 = new Thread(AcquireImageFromDevice);
thread1.Start();
while (thread1.IsAlive)
{
Thread.Sleep(10);
}
}
private void AcquireImageFromDevice()
{
using (DeviceManager deviceManager = new DeviceManager())
{
deviceManager.Open();
...
device.ImageAcquired += new EventHandler<ImageAcquiredEventArgs>(device_ImageAcquired);
device.Acquire();
while (device.State != DeviceState.Opened)
{
System.Windows.Forms.Application.DoEvents();
}
device.ImageAcquired -= new EventHandler<ImageAcquiredEventArgs>(device_ImageAcquired);
}
}
private void device_ImageAcquired(object sender, ImageAcquiredEventArgs e)
{
Console.WriteLine("Image is acquired");
}
Best regards, Alexander