c# - How do I call a DLL which does a time consuming task? -


enter image description here

in wpf application, have communicate datastor on serial port. want separate communication class library simplicity.

in dll, issuing command datastor , wait 10 seconds receive response back. once response datastor, compile data meaningful info , pass main application.

my question how make main application pause while data external dll , continue processing data dll?

i use .net 4.0

consider calling dll method in new thread

thread dllexecthread = new thread(dllmethodtoexecute); 

and providing callback main program dll can executed when complete (this prevents locking on gui).

edit: or simplicities sake if want main program wait dll finish execution subsequently call:

dllexecthread.join(); 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -