Tuesday, August 05, 2008

Getting started with SharePoint and Silverlight - Part II - Update for Silverlight 2 Beta2

In Getting started with SharePoint and Silverlight - Part II I talked about the Silverlight Blueprints for SharePoint. With the recent release of Silverlight 2 Beta2 I was wondering how easy it would be to get the Silverlight BluePrint to work with it. Unfortunately, things did not work quite easily - for an overview of changes in beta2  take a look at http://blogs.msdn.com/silverlight_sdk/archive/2008/06/04/breaking-changes-for-silverlight-2-beta-2-corrections-and-additions.aspx

For the HelloSilverlight sample the change is pretty simple:

  • Rebuild Silverlight applications and copy the XAP file to the clientbin directory
  • Remove the version property for the SilverlightControl - this seems to be removed in beta2.
  • Rebuild and deploy to the GAC. Perform iisreset.

If you look at the Silverlight Mediaviewer webpart you will notice that this one is a little more complicated to update to Silverlight 2.0 beta.

The main problem with SharePoint integration and  Silverlight 2.0 beta 2 is the change  to HttpWebRequest class - delegates are called on a new non-UI  background thread. This means that you will need to use System.Threading.SynchronizationContext to update the UI on the background thread. It took me a while to figure this one out ... after I finally found the solution I found this great posting about the necessary changes (would have spared me a couple of hours) - Porting the Silverlight Blueprints for SharePoint to Silverlight 2 Beta2.

No comments: