I am using an old COM component (communications class library) in a new C# application. The COM control handles communication with some of our instruments. One of the functions is to download data, which, depending on the size of data, can be a rather lengthy operation. The new C# app is set up to handle the downloading as a thread. The problem is, when the code is executing the download function, everything else freezes up, so I cannot click a 'Cancel' button in the UI. I've added a Sleep () (trying everything from 0 to 1000 as params) call to the download code after every block without success. The part that has me confused is if my download thread, instead of calling into the COM control, simply executes an infinite loop in C#, I can cancel out of that because the UI is active. Does anyone have any thought on what I can try to make the download thread yield?
Thanks