Thursday, June 12, 2008

Creating a CWA client with Silverlight 2: Upgrading from the beta 1 to beta 2.

First things I did was uninstalling Blend 2.5 March preview and the Silverlight 2 beta 1 Visual Studio tools.

Then Installed the Blend 2.5 June Preview end the Silverlight 2 beta 2 SDK.

I opened my existing Silverlight 2 beta 1 project. Got the question to convert it, converted it and I could build my solution without a problem.

No problems till I first started to run the project. Got the statement that I had to Uninstall the beta 2 and reinstall the beta. This was an easy problem to solve. When you upgrade from silverlight 2 beta 1 to the beta 2 the silverlight project is upgraded. But what wasn't upgraded was the web page that is hosting your silverlight app. This is easy to fix . In your web application properties remove and add your silverlight application.

image

Now you can start your silverlight application.

Invalid cross-thread access

It looked as if everything was working, until I logged in. Then I got an Invalid cross-thread access error.

Hmm something really has changed. In de Microsoft® Silverlight™ 2 Software Development Kit Beta 2 Documentation which has to be downloaded separately there is a list breaking changes between Beta 1 and the Beta 2.

In this case the changes on the HttpWebRequest caused the error. All delegates on the HttpWebRequest are changed to return on a background thread. If you try to update your UI from a background threat you get this error.

The solution

It's quite easy to handle this problem. On all Silverlight Controlls there is a Dispatcher property. Use this property to update your UI

this.Dispatcher.BeginInvoke(delegate()
{
//DO your UI update


});



That were the only things that I had to do upgrading from the beta 1 to the beta 2.



What's coming up next on silverlight beta 2 and CWA. The Beta 2 has a new tabbed control. I had created one my self and I will have a look how easy it is to use this new control.



For more information sip:Marc.Wetters@e-office.com



 



No comments:

working at e-office