Monday, March 15, 2010

The Silverlight 4 Release Candidate

Scott Guthrie et al. announced many awesome new things during the keynotes at Microsoft's MIX10 conference. One of it was the Silverlight 4 Release Candidate which replaces the beta version and is now available for download. Beside all the great new features that were added, it's now finally possible to use the Visual Studio 2010 RC for Silverlight 4 development. Kudos to the Silverlight team for catching up with Visual Studio 2010 and all the cool new features they implemented. 

The final Silverlight 4 RTW version will be available next month (April 2010). Additonaly the first CTP of the Winows Phone SDK was released and Silverlight is THE platform for Windows Phone 7 series development and it's free! Silverlight for Symbian is also now available for Nokia S60 5th Edition devices like the N97. So Silverlight is becoming more and more a full multi platform technology. Awesome!

This blog post focuses on the Silverlight 4 RC and contains a summary of all the new features that were added since the Silverlight 4 Beta to the Silverlight 4 RC and the breaking changes that naturally come along with betas. Plus some details about the CaptureSource's new capture usage pattern.


New Silverlight 4 RC features

Rich Text
  • RichTextBox rename
  • Text position and selection APIs
  • XAML property for serializing text content
  • XAML clipboard format
  • FlowDirection support on Runs
  • "Format then type" support
  • Thai / Vietnamese / Indic support
  • UI Automation Text pattern
Networking
  • UploadProgress support (Client stack)
  • Caching support (Client stack)
  • Sockets security restrictions removal (Full Trust)
  • Sockets policy file retrieval via HTTP
  • Accept-Language header
Out of Browser (Full Trust)
  • XAP signing
  • Silent install and emulation mode
  • Custom window chrome
  • Better support for COM Automation
  • Cancelable shutdown event
  • Updated security dialogs
Media
  • Pinned full-screen mode on secondary display
  • Webcam / Mic configuration preview
  • More descriptive MediaSourceStream errors
  • Content & Output protection updates
  • Updates to H.264 content protection (ClearNAL)
  • Digital Constraint Token
  • CGMS-A
  • Multicast
  • Graphics card driver validation & revocation
Graphics and Printing
  • Hardware accelerated perspective transformations
  • Ability to query page size and printable area
  • Memory usage and performance improvements
Data
  • Entity-level validation support of INotifyDataErrorInfo for DataGrid
  • XPath support for XML
Parser
  • New architecture enables future innovation
  • Performance and stability improvements
  • XmlnsPrefix & XmlnsDefinition attributes
  • Support setting order-dependent properties
Globalization & Localization
  • Support for 31 new languages
  • Arabic, Hebrew and Thai input on Mac
  • Indic support
More
  • Update to DeepZoom code base with hardware acceleration
  • Support for Private mode browsing
  • Google Chrome support (Windows)
  • FrameworkElement.Unloaded event
  • HTML Hosting accessibility
  • IsoStore performance improvements
  • Native hosting performance improvements (e.g. Bing Toolbar)
  • Consistency with Silverlight for Mobile APIs and Tooling
  • System.Numerics.dll
  • Dynamic XAP support (MEF)
  • Frame / Navigation refresh support
The new webcam and microphone configuration preview is pretty neat. The user can now select the default webcam & microphone device really comfortable and we only need to use CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice() or CaptureDeviceConfiguration.GetDefaultAudioCaptureDevice() to get the selected default video and audio device.


The webcam permission dialog is now consent and can remember if the user has previously allowed that certain application. Tim Heuer's blog post has more details about this handy new feature.


Breaking Changes since the Silverlight 4 beta
The first and most important take away: As usual all Silverlight 4 beta applications have to be updated to the RC and recompiled, otherwise the new RC runtime won't execute them.
  • Renamed RichTextArea to RichTextBox
  • Changes to DRM API
  • TextSelection.SetPropertyValue is now named .ApplyPropertyValue
  • INotifyDataErrorInfo moved to core (System.Windows.dll)
  • WebBrowser.ScriptNotify signature change
  • NotificationWindow.Visible and NotificationWindow.Closed were changed
  • Webcam and output protection change
  • COM Interop API changes (name and namespace)
  • RichTextBox.TextWrapping default value changed
  • Binding declarations in XAML where the target is a DependencyObject
  • HtmlBrush renamed to WebBrowserBrush

The official breaking changes document contains all the details and Koen Zwikstra (@kozw) has made some useful diff lists.

Changed usage pattern for AsyncCaptureImage
The biggest difference in the webcam API besides the renaming of some enums, properties and other members is the change of the AsyncCaptureImage method which was renamed to CaptureImageAsync. Additionally the usage pattern of the CaptureImageAsync method was updated to the standard .Net / Silverlight asynchronous event pattern.

Before the Silverlight 4 RC, AsyncCaptureImage was used like this:
// Initialization
captureSource = new CaptureSource();
captureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

// Capture image
captureSource.AsyncCaptureImage(bitmap =>
{
   // Process camera snapshot
   Process(bitmap);
});

The new RC CaptureImageAsync usage pattern:
// Initialization
captureSource = new CaptureSource();
captureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
// Wiring the CaptureImageCompleted event handler
captureSource.CaptureImageCompleted += (s, e) =>
{
   // Process camera snapshot (e.Result is a WriteableBitmap)
   Process(e.Result);
};

// CaptureImageAsync fires the CaptureImageCompleted event
captureSource.ImageCaptureAsync();

Although the pre-RC pattern was smaller and easier, it's overall more consistent now and I welcome the changes.

Blog.SL4++
I already updated SLARToolkit and the samples and I will continue to update some of my Silverlight 4 beta samples during the next days. Furthermore I will make a Silverlight 4 RC build of the Matrix3DEx sample that should take advantage of the new hardware accelerated perspective transformations.

2 comments: