In my case for the COM code to work it must update the UI thread. To accomplish this I had to move the reference from the main page, which was apparently passing through the Deployment object, to explicitly calling the Deployment object.
So in the case of the main page or I suspect any xmal pages code behind use this line of code in the ClientRequestSucceededEventHandler method:
this.Dispatcher.BeginInvoke(updateUI);
For separate classes to gain access to the UI thread use this line of code in the ClientRequestSucceededEventHandler method:
Deployment.Current.Dispatcher.BeginInvoke(updateUI);
Reference:
http://www.go4answers.com/Example/error-invalid-cross-thread-access-48335.aspx
Using Silverlight Object Model: http://msdn.microsoft.com/en-us/library/ee538971.aspx
No comments:
Post a Comment