-
October 18th, 2010, 10:07 AM
#1
Access Paragraph created in non-UI thread?
The main class initializes a List<Paragraph> object. New paragraphs are created in a new Task and added to the list of paragraphs. Upon Task completion the paragraph list is scanned in order to append the individual paragrahs to a RichTextBox. However, I get "The calling thread cannot access this object because a different thread owns it" and I suppose it means that paragraphs created in a non-UI thread cannot be access in the UI thread.
Anyone know a workaround for this? Thanks.
-
October 18th, 2010, 02:26 PM
#2
Re: Access Paragraph created in non-UI thread?
You communicate between threads by the use of delegates. You can pass a method to your non-UI thread that can be executed on the UI thread periodically or when the task is complete. If you use a BackgroundWorker it is even easier; just handle the DoWork event (and a couple others).
-
October 21st, 2010, 07:32 AM
#3
Re: Access Paragraph created in non-UI thread?
Is there a limit to the number of BeginInvoke() calls that the main thread Dispatcher can enqueue for later processing? Thanks.
Last edited by tr00don; October 21st, 2010 at 10:35 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|