470,849 Members | 1,106 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

c#-APP multithread(backgroundworker) problem

1
Hi there, I have an application that have 1 backgroundworker doing operation in hw through rs232 (like a pooling constantly). In my UI thread I have do operations also on that resource (rs232 resource).
The problem: When I click a button to send data over th rs232 and the worker is doing Some operation (backWorker.IsBusy == true) I send a cancelAsync to the worker, but I have to wait to perform operations.

I try to sleep the current UI Thread but holds the app.
Is any way that I can click on button (that send data over the resource), stop background, and perform the operation on button click event without user noticed?.
Now:
I have a button click and when y detect that backworker isbusy I send a cancelAsync, show a MEssagebox to the user that said "the system is busy, perform operations when a green image shows (something likie a semaphore). And then the user must click again to the same click (so annoying)

I would like this behaviour:
the worker is working all the time. So when I click the button, send the stop to the worker, wait for the resource be free and perform actions on the button event and put an advice "The actions are performing. Please wait... ", and when finish doing the button click method, something like. "Everything is ok! or some problem have found!"

I hoped to be clear. sorry about my english.
thanks in advance.

Zektor
Jul 8 '08 #1
0 867

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Sebastian Crewe | last post: by
reply views Thread by Chris | last post: by
4 posts views Thread by =?Utf-8?B?U3ZlbiBXLg==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.