The recently released Beta2 of Silverlight 2 has unfortunately broken the Silverlight Blueprints for SharePoint. The team has announced on their CodePlex site that they will release a new version for Beta2, but in the meantime, here’s a summary of what I changed to make the Blueprints run on Beta2.
First, a caveat: I only ported the MediaViewer control, a.k.a. the “Picture Viewer Sample” because that’s what I needed. Other samples may require more work!
The main problem I had when I upgraded to Beta2 is the change to HttpWebRequest behavior: its delegates are now called on a background thread, which means you have to change the way it is used in the current Blueprints code (which was written for Beta1, where HttpWebRequest delegates were called on the main UI thread).
Thanks to scorb’s great post on Silverlight HTTP networking, here’s what I changed:
- Moved the call to request.BeginGetResponse() from BuildPreviewBar() to the end of RequestCallback(), so that it is called on the background thread
- Hacked the ResponseCallback() method so that it calls back to the main UI thread to set up the thumbnails etc. (using System.Threading.SynchronizationContext)
And that’s about it!
Attached to this post: the modified source code for Page.xaml.cs in SL.XAML.MediaViewer.