I have an architectural issue that I have been working on for quite awhile
now and I would like another person's point of view. This issue involves the
conversion of a VB6 app to VB.NET.
In this VB6 app, the original programmer used 5 timers to periodically scan
a document, process it, and display thumbnail images of the scanned
document. These 5 timers implement 5 different subroutines that enable this
process. In my conversion of this app to VB.NET, I have investigated and
implemented threads, threadpools, timers, and now async delegates with
varying degrees of success (in regards to application performance.)
What I am trying to do is to try to simulate the original VB6 timers (that
implement the 5 different routines) to the new .NET approach as follows:
Original New
VB6 App VB.NET App
-------------------------------------------
Timer 1 Main Threading Timer - (Encapsulates Threadpools 2 thru 5)
Timer 2 Threadpool 1 - (Scans document)
Timer 3 Threadpool 2 - (Executes another program as a process for
image character recognition)
Timer 4 Thread pool 3 - Display Thumbnail images
Timer 5 Threadpool 4 - Exits after the above Threadpools are done
This worked but was so CPU intensive that it did not allow me to implement
other features. For example, once the app started running, it was polling
the scanner so much that the UI did not allow me select the scanned bitmap
images to expand them. When I varied the Threading Timer values, I was able
to expand the bitmap images but it was still very slow. I understand that
win forms are not thread safe and I did implement the code necessary (ie.
invoke required...etc.).
I understand that using Async delegates can also do the polling necessary
and some have stated that it is "cleaner" than using Timers and Threadpools
in this case. Architecturally speaking, what would be the best way to have
this converted to VB.NET and still have the same functionality and
responsiveness?? What other approach would I use other than what I have
described?? Since responsiveness is the key, is using Async delegates a
viable option??
Thanks so much in advance!
Viet