Even a chimp can write code

Monday, March 10, 2008

Silverlight 2: Application model

The first public beta of Silverlight 2 is now live. If you've played with building apps on it, you know we weren't kidding when we used the "Windows Presentation Foundation / Everywhere" moniker. Although we didn't inflict that monstrosity of a name on you, we did bring much of the sheer goodness of WPF in the APIs, the depth of functionality, the extensibility points and the overall experience designing or developing one of these babies.

In this first installment of a series of posts on Silverlight 2 features, I'll talk about the new Application Model. I'll loosely define an Application Model as "the principles on what constitutes an application, how it's lifetime is governed, and the set of services offered by a platform or runtime to the application". The Silverlight 2 Application Model borrows heavily from that of WPF. And it's goals are to be simple and predictable, to provide extensibility hooks, and otherwise to stay out of the way.

The Silverlight 2 application
The Silverlight 2 application is a client-side entity running within the confines of a host such as a browser. It is a packaged archive -- we use the Zip data compression and archival format -- with the .xap file extension and application/x-silverlight-app MIME type. Despite the introduction of this new application file, the Silverlight 2 runtime continues to support vanilla XAML content specified via file Uri or inline reference to SCRIPT block a la the v1.0 programming model.

Here's an outline of the features supported in the new application model:

  • New application package unit
  • Encapsulation of application functionality in a type deriving from System.Windows.Application, along with app definition XAML
  • Application lifetime: ctor, Startup event, Exit event
  • Handle exception conditions in a central location at the app level
  • Support for declarative dependency downloads, as well as programmatic for more granular control
  • Utility methods to extract app resources or resources from arbitrary Zip packages
  • Access to the Silverlight plug-in's object model via the Host property
  • Default splash screen provided by the platform, with ability to override it using custom XAML and JavaScript
  • Support for activating a Silverlight application from cross-domain (x-domain) to HTML page; secure by default, and ingress/egress need to be opted into.
  • Ability to refactor application functionality into individual pieces, daisy-chained together and dynamically loaded at runtime

A more detailed overview of the new Silverlight 2 application model is provided in this slide deck I've posted on my sky drive. The Silverlight 2 application model documentation on MSDN is a must-read. As always, feedback is appreciated. You can drop a comment here or post on the Silverlight forums.

Labels: ,

Email this | Bookmark this


Post a Comment | Home | Inference: my personal blog