Last Friday, July 27th, the 1.1 Alpha Refresh of Silverlight was released into the wild, breaking any previous Silverlight Alpha applications... including mine of course...
This morning I released updated versions of Silverlight Rocks! and Destroy All Invaders which are compatible with the 1.1 Alpha Refresh. Here are links to the updates (they use the same url's as previously so no need to update links you may have elsewhere):
Silverlight Rocks! [source and info] [play it]
Destroy All Invaders [source and info] [play it]
There are lots of useful blog entries with help on migrating from 1.1 Alpha to the 1.1 Alpha Refresh but I did hit a couple of issues that I didn't see mentioned elsewhere...
Storyboard.Begin() Behaves Differently
IMPORTANT: Read below for update to this problem!! The biggest snag I hit was that the behavior of Animation.Storyboard.Begin() apparently changed with the 1.1 Alpha Refresh. In the previous Alpha, it was possible to use a Storyboard DoubleAnimation to mimic a timer and form a Game Loop around it. But in the latest refresh, calling Storyboard.Begin() will cause the immediate execution of it's Completed event. This causes an endless loop with no UI updates when you call Storyboard.Begin() at the end of you game loop.
I wasn't able to find a way around this Storyboard.Begin() issue so instead I replaced my Storyboard timer with a browser timer like so:
System.Windows.Browser.HtmlTimer timer;
timer = new System.Windows.Browser.HtmlTimer();
timer.Interval = 20; // not really reliable :(
timer.Tick += new EventHandler(timer_Completed);
There are two problems with this. The first is that HtmlTimer is marked obsolete and has the following compiler warning:
System.Windows.Browser.HtmlTimer' is obsolete: 'This is not a high resolution timer and is not suitable for short-interval animations. A new timer type will be available in a future release.
... and the second problem is that the Interval property does not seem all that reliable in determining frame rate (as the compiler warning states). But, it does seem somewhat adequate at least until "a new timer type is available in a future release" (let's hope that warning is accurate).
UPDATE: Thanks to John Donnelly and Chris Cavanagh for both setting me straight on the Storyboard problem! It turns out the change in behavior for Storyboard is that you must have an animation target for the Storyboard, or an exception is thrown. Here is an example of setting up the Storyboard as timer:
<!-- Set up our game timer. As of Alpha 1.1 Refresh, you NEED to give the timer a bogus target to avoid exceptions -->
<Canvas.Resources>
<Storyboard x:Name="timer">
<DoubleAnimation Duration="00:00:00.01" Storyboard.TargetName="bogusTimerTarget" Storyboard.TargetProperty="Width" />
</Storyboard>
</Canvas.Resources>
<Canvas Name="bogusTimerTarget">
</Canvas>
I have updated both Silverlight Rocks and Destroy All Invaders samples with this fix.
Silverlight Template and SDK Have Wrong Silverlight.js
It turns out that the Alpha 1.1 Refresh SDK and Visual Studio Project Template add in the wrong version of Silverlight.js. The end result of this is that if a user visits your Silverlight-enabled web page and they do not have Silverlight 1.1 installed, the little icon that appears to install will point them to the 1.0 install instead of 1.1. The solution is to "borrow" the correct 1.1 version of Silverlight.js from somewhere else as described in this very helpful forum post.
Hidden Visibility went Bye-bye
This is the one breaking change that I knew about before going into the conversion and was the easiest to solve. Basically just do a find-and-replace for Hidden wherever it is used to assign Visibility, and replace it with Collapsed.
Well, that's about it. I have to say the conversion took me longer than anticipated because of the first two issues. But being this is still only Alpha I am anticipating even more fun migrations in my near future :)