Advertisement

07.23.2008 at 09:30AM PDT, ID: 23589136
[x]
Attachment Details

MultiThreaded winform handling events

Asked by EdSoftware in Windows Forms for .Net, C# Programming Language, .NET Framework 3.x versions

Tags: c#, winform

I have an object that interfaces to a TWAIN device.  The object raises events after each scan.  The GUI subscribes to these events to get the image that was scanned, error events, and some other information about the scan.  I execute the functionality in single threaded winform (.net 3.5) application.

Because the scanning can take 10 seconds, and it hogs the thread on the UI so it becomes unresponsive, i would like to run the scan on a background thread.  

Can someone show me how to do this in a way that the events that the Twain object raises are handled safely?

Currently:
1. Create instance of TwScan
2. Hook events to listen to.
3. Invoke StartScan method on the instance
as scanning proceeds, my winform handles the events.

How to modify to operate the TwScan on the background thread, yet have the events raised on the UI thread?
Start Free Trial
[+][-]07.24.2008 at 01:37AM PDT, ID: 22077068

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 02:58AM PDT, ID: 22077412

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 03:28AM PDT, ID: 22077560

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.25.2008 at 06:04AM PDT, ID: 22088098

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Windows Forms for .Net, C# Programming Language, .NET Framework 3.x versions
Tags: c#, winform
Sign Up Now!
Solution Provided By: EdSoftware
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628