multithreading - Threading with IProgressDialog in c# -


i want add native windows progressdialog c# application. better control defined onusercancled event. after showdialog() calls main form,progressdialog class starts thread checks if native progressdialog canceled or not.but problem iprogressdialog belongs main thread , cannot accessed checker thread.the error serious:

unable cast com object of type 'windowsdialogs.invokes.interfaces.iprogressdialogc' interface type 'windowsdialogs.invokes.interfaces.iprogressdialog'. operation failed because queryinterface call on com component interface iid '{ebbc7c04-315e-11d2-b62f-006097df5bd4}' failed due following error: no such interface supported (exception hresult: 0x80004002 (e_nointerface)).

i want know there way invoke commands main class(like invoke() method in .net form ).

note: timer class has same problem...

you should calls progress dialog in ui thead. in wpf do:

dispatcher.invoke((action)delegate() {     _progressdialog.setprogress(percentcomplete, 100); }); 

for winforms, guess control.invoke: http://msdn.microsoft.com/en-us/library/zyzhdc6b.aspx


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -