I currently working on a simple crypto-chat application and came across a problem that's driving me nuts.
I've got 2 threads: At first the main application thread with window handles, and at second a thread for receiving incoming text messages. The second thread calls a callback to the Home.xaml.cs-Page in order to update a RichTextBox. This Callback crashes when
accessing the RichtTextBox and says something like "This thread cannot access this object cause it's owned by another thread".
After some research I found some information about resolving this problem by using Invoke.
Thread t = new Thread(new ThreadStart(update));
private void update()
//threadsafe call of "Application.Current.Shutdown"
Unfortunately I cannot find a method "Invoke", "BeginInvoke" or any similar for the m:ui control objects.
So can anyone tell me how to update the RichTextBox or any other value of the control objects in a threadsafe way?
If you think I missed any important information, just ask for it. Hope you can help me with this problem.
Thx in advance, ep1stle