المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : cross thread operations



C# Programming
06-02-2009, 11:21 PM
look at this situation(this is just an example for clarification):
i have 2 threads:
thread1: is my main thread,( the static Program class) and should for example Run a form.
thread2: is my sec thread and should show a Splash screen that should be displayed according to my main thread.
thread1(main) wants to update a progressbar on thread2. i am a little confused... http://www.barakasoft.com/script/Forums/Images/smiley_WTF.gif

my solution:
i guess that i could solve this by implementing events, rising them on thread1 and Handling them on thread2 and do the requested job accordingly(i.e. updating a progress).
but sth new arises and that was Cross-Thread-Oper... , and there is no Invoke Metod for my this obj (that is Static Program class, don't call me stupid) to prevent this exception(cross-thread-...excption).