excel, c sharp and sync context

Joined
Oct 11, 2009
Messages
1
Reaction score
0
In the web I searched the article about
Application.DoEvents in a WPF class library
"First, DoEvents is a Bad Thing. Don't use it if you don't have to.
Which is never ;-p. If you have something long-running, you should be
doing it on a worker thread, and talking to the UI thread for
updates. From within a class library, you can do this either by
raising events (that the UI handles including thread-switching), or
via sync-context - SynchronizationContext.Current.Post or
SynchronizationContext.Current.Send."

I want to know what is sync-context - SynchronizationContext.Current.Post or
SynchronizationContext.Current.Send."??

As I have made c# dll with three functions used for excel.
In excel, I have three buttons to call these functions.
But There is one button A which will run for a long time.
During the meantime, I want to click another button B but the cursor
does not allow me to click.
Then I changed the function (button A) to be threading.
Then The cursor allow me to click while it is running.
But when I click button B, the excel seems to be hanged
and then exit and recover to open.
How to solve this in c# dll?? Is there anything I can do??

Please help!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top