Tuesday, August 12, 2008

IronPython + Silverlight 2β2

This finally bubbled to the top of my "must get around to, some time" stack today…

Recording what I needed to do to get the second Voidspace controls example to work with the later beta:

  1. Remove all the assemblies in the app folder.
  2. Copy in System.Windows.Controls.Extended.dll (only) from the Silverlight beta 2 SDK.
  3. In the web page, set the type to be "application/x-silverlight-2-b2".
  4. In AppManifest.xaml, update RuntimeVersion to "2.0.30523.06".
  5. Add <AssemblyPart Source="Microsoft.Scripting.Core.dll" /> to the manifest.
  6. In the python source, remove the System.Windows.Controls reference, and update System.Windows.Controls.Extended to version
  7. Replace WatermarkTextBox with just plain TextBox.

Only needing an <object> tag with type and data attributes, it works in Firefox 3 -- you just have to explicitly go and install the beta (the fallback link inside the <object> tag didn't show with FF3 and Silverlight 1).

So here it is -- 1k of code along with 1.2M of infrastructure assemblies (which is a megabyte more weight than Jython would need for the equivalent).

Sample removed from here 13-Dec-08 as the beta release is now obsolete.. New sample here.

For comparison

274467 Aug 13 21:47 applet.jar
     1229665 Aug 12 20:22 app.xap
        2260 Aug 12 20:22 index.html
        2071 Aug 13 21:47 jython.html

1 comment :

Michael Foord said...

Heh, thanks. :-)

I've actually updated most of my examples to 2b2, just not posted them on the web yet. :-(

Hopefully I'll find time for it soon. Also, you can specify that the IP / DLR assemblies be kept outside the xap - and then they can be shared between applications and live in the browser cache (just downloaded once per site).